Description
This AppleScript saves a list of all the open tabs in your (frontmost) Safari window to a new outline in OmniOutliner – Perfect for keeping track of webpages to return to later instead of keeping a billion tabs open all the time.Alfred Users
I've rolled this script into a ready-to-go workflow for you – click here to download it. I've given it a default keyword of "stoo" (as in "Safari Tabs to OmniOutliner") to make it work with some of the other "Save Tabs" workflows.Launchbar 6 Users
I've assembled this script into a pre-packaged Action for you as well! Consider this "Experimental" as I'm new to LB6 but, if you want to try it out, click here to download it. Enjoy!The Code
(*
◸ Veritrope.com
Save Safari Tabs to OmniOutliner
VERSION 1.0
June 15, 2014
// TERMS OF USE:
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
// LIKE THIS SCRIPT?
If this AppleScript is helpful to you, please show your support here:
http://veritrope.com/support
// SCRIPT INFORMATION AND UPDATE PAGE
http://veritrope.com/code/save-safari-tabs-to-omnioutliner
// REQUIREMENTS
More details on the script information page.
// CHANGELOG
1.00 INITIAL RELEASE
*)
(*
======================================
// MAIN PROGRAM
======================================
*)
--RESET VALUES
set urlList to {}
set currentTab to 0
--SET DATE STAMP
set the dateStamp to ((the current date) as string)
set noteTitle to "URL List from Safari Tabs on " & the dateStamp
--MAKE NEW OUTLINE
tell application "OmniOutliner" to set newOut to make new document with properties {name:noteTitle}
set docName to (name of newOut)
--PROCESS TABS OF FRONTMOST SAFARI WINDOW
tell application "Safari"
set successCount to 0
set safariWindow to the front window
set tabCount to (count of (tabs of safariWindow))
--GET TAB INFORMATION
try
repeat with t in (tabs of safariWindow)
set currentTab to currentTab + 1
set tabTitle to (name of t)
set tabURL to (URL of t)
--MAKE ROW IN OMNIOUTLINER
tell application "OmniOutliner"
tell its document docName
set aRow to make new row with properties {topic:tabTitle, note:tabURL}
set note expanded of aRow to true
expandAll
end tell
end tell
--INCREMENT SUCCESS COUNT
set successCount to (successCount + 1)
end repeat
end try
end tell
--NOTIFY RESULTS
my notification_Center(successCount, tabCount)
(*
======================================
// NOTIFICATION SUBROUTINE
======================================
*)
--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 OmniOutliner" subtitle "◸ Veritrope.com"
else if Plural_Test is 0 then
display notification "No Tabs Exported!" with title "Send Safari Tabs to OmniOutliner" subtitle "◸ Veritrope.com"
else if Plural_Test is equal to 1 then
display notification "Successfully Exported " & itemNum & ¬
" Tab to OmniOutliner" with title "Send Safari Tabs to OmniOutliner" subtitle "◸ Veritrope.com"
else if Plural_Test is greater than 1 then
display notification "Successfully Exported " & itemNum & ¬
" Tabs to OmniOutliner" with title "Send Safari Tabs to OmniOutliner" subtitle "◸ Veritrope.com"
end if
set itemNum to "0"
delay 1
end notification_Center
◸ Veritrope.com
Save Safari Tabs to OmniOutliner
VERSION 1.0
June 15, 2014
// TERMS OF USE:
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
// LIKE THIS SCRIPT?
If this AppleScript is helpful to you, please show your support here:
http://veritrope.com/support
// SCRIPT INFORMATION AND UPDATE PAGE
http://veritrope.com/code/save-safari-tabs-to-omnioutliner
// REQUIREMENTS
More details on the script information page.
// CHANGELOG
1.00 INITIAL RELEASE
*)
(*
======================================
// MAIN PROGRAM
======================================
*)
--RESET VALUES
set urlList to {}
set currentTab to 0
--SET DATE STAMP
set the dateStamp to ((the current date) as string)
set noteTitle to "URL List from Safari Tabs on " & the dateStamp
--MAKE NEW OUTLINE
tell application "OmniOutliner" to set newOut to make new document with properties {name:noteTitle}
set docName to (name of newOut)
--PROCESS TABS OF FRONTMOST SAFARI WINDOW
tell application "Safari"
set successCount to 0
set safariWindow to the front window
set tabCount to (count of (tabs of safariWindow))
--GET TAB INFORMATION
try
repeat with t in (tabs of safariWindow)
set currentTab to currentTab + 1
set tabTitle to (name of t)
set tabURL to (URL of t)
--MAKE ROW IN OMNIOUTLINER
tell application "OmniOutliner"
tell its document docName
set aRow to make new row with properties {topic:tabTitle, note:tabURL}
set note expanded of aRow to true
expandAll
end tell
end tell
--INCREMENT SUCCESS COUNT
set successCount to (successCount + 1)
end repeat
end try
end tell
--NOTIFY RESULTS
my notification_Center(successCount, tabCount)
(*
======================================
// NOTIFICATION SUBROUTINE
======================================
*)
--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 OmniOutliner" subtitle "◸ Veritrope.com"
else if Plural_Test is 0 then
display notification "No Tabs Exported!" with title "Send Safari Tabs to OmniOutliner" subtitle "◸ Veritrope.com"
else if Plural_Test is equal to 1 then
display notification "Successfully Exported " & itemNum & ¬
" Tab to OmniOutliner" with title "Send Safari Tabs to OmniOutliner" subtitle "◸ Veritrope.com"
else if Plural_Test is greater than 1 then
display notification "Successfully Exported " & itemNum & ¬
" Tabs to OmniOutliner" with title "Send Safari Tabs to OmniOutliner" subtitle "◸ Veritrope.com"
end if
set itemNum to "0"
delay 1
end notification_Center
Thank you very much for the great Tabs to OmniOutliner scripts. I would appreciate the possibility to append new tabs to a file instead of creating a new one all the time which should not be too difficult. Due to my lack of Apple Script knowledge I fail to adapt the script to something like
and than add the open tabs there. Thanks!
An interesting idea – will keep it in mind for a future project!