Created
January 16, 2016 15:16
-
-
Save nrollr/a3e04382dab8fc27a6f5 to your computer and use it in GitHub Desktop.
Save open Safari tabs to Reminders.app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set currentTab to 0 | |
set the dateStamp to ((the current date) as string) | |
set listName to "Open Safari Tabs, dated: " & the dateStamp | |
tell application "Safari" | |
activate | |
set safariWindow to the front window | |
set successCount to 0 | |
set tabCount to (count of (tabs of safariWindow)) | |
tell application "Reminders" to set theList to (make new list with properties {name:listName}) | |
repeat with w in safariWindow | |
try | |
repeat with t in (tabs of w) | |
set TabTitle to (name of t) | |
set TabURL to (URL of t) | |
--MAKE REMINDER | |
tell application "Reminders" | |
tell theList | |
make new reminder with properties {name:TabTitle, body:TabURL} | |
end tell | |
end tell | |
--INCREMENT SUCCESS COUNT | |
set successCount to (successCount + 1) | |
end repeat | |
end try | |
end repeat | |
end tell | |
--NOTIFY RESULTS | |
my notification_Center(successCount, tabCount) | |
--NOTIFICATION CENTER | |
on notification_Center(successCount, itemNum) | |
set Plural_Test to (successCount) as number | |
if Plural_Test is -1 then | |
display notification "No Tabs Exported!" with title "Send Safari Tabs to Reminders" | |
else if Plural_Test is 0 then | |
display notification "No Tabs Exported!" with title "Send Safari Tabs to Reminders" | |
else if Plural_Test is equal to 1 then | |
display notification "Successfully Exported " & itemNum & ¬ | |
" Tab to Reminders" with title "Send Safari Tabs to Reminders" | |
else if Plural_Test is greater than 1 then | |
display notification "Successfully Exported " & itemNum & ¬ | |
" Tabs to Reminders" with title "Send Safari Tabs to Reminders" | |
end if | |
set itemNum to "0" | |
delay 1 | |
end notification_Center |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment