This AppleScript saves a list of all the open tabs in your (frontmost) Safari window to a new list in DEVONthink Pro – 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 […]

(*
◸ Veritrope.com
Save Safari Tabs to DEVONthink Pro
VERSION 1.0
June 16, 2014
)

// UPDATE NOTICES
     ** Follow @Veritrope on Twitter, Facebook, Google Plus, and ADN for Update Notices! **

// SUPPORT VERITROPE!
     If this AppleScript was useful to you, please take a second to show your love here:
     http://veritrope.com/support

// SCRIPT INFORMATION AND UPDATE PAGE
     http://veritrope.com/code/save-safari-tabs-to-devonthink

// REQUIREMENTS
     More details on the script information page.

// CHANGELOG
    1.0  INITIAL RELEASE

// 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.


*)


(*
======================================
// MAIN PROGRAM
======================================
*)


-- PREPARE THE LIST
set urlList to {}
set the date_stamp to ((the current date) as string)
set NoteTitle to "URL List from Safari Tabs on " & the date_stamp

--PROCESS TABS OF FRONTMOST SAFARI WINDOW
tell application "Safari"
    activate
    set safariWindow to the front window
    set successCount to 0
    set tabCount to (count of (tabs of safariWindow))
   
    repeat with w in safariWindow
        --GET TAB INFORMATION  
        try
            repeat with t in (tabs of w)
                set TabTitle to (name of t)
                set TabURL to (URL of t)
                set TabInfo to ("<a href=\"" & TabURL & "\">" & TabTitle & "</a><br/>")
               
                --COPY TAB INFO TO END OF LIST 
                copy TabInfo to the end of urlList
               
                --INCREMENT SUCCESS COUNT
                set successCount to (successCount + 1)
               
            end repeat
        end try
    end repeat
end tell

--CONVERT LIST TO TEXT
set old_delim to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set url_list to urlList as text
set AppleScript's text item delimiters to old_delim

--MAKE THE ITEM IN DEVONthink Pro  
tell application "DEVONthink Pro"
    create record with {type:html, source:url_list, name:NoteTitle} in current group
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 DEVONthink Pro" subtitle "◸ Veritrope.com"
       
    else if Plural_Test is 0 then
        display notification "No Tabs Exported!" with title "Send Safari Tabs to DEVONthink Pro" subtitle "◸ Veritrope.com"
       
    else if Plural_Test is equal to 1 then
        display notification "Successfully Exported " & itemNum & ¬
            " Tab to DEVONthink Pro" with title "Send Safari Tabs to DEVONthink Pro" subtitle "◸ Veritrope.com"
       
    else if Plural_Test is greater than 1 then
        display notification "Successfully Exported " & itemNum & ¬
            " Tabs to DEVONthink Pro" with title "Send Safari Tabs to DEVONthink Pro" subtitle "◸ Veritrope.com"
    end if
   
    set itemNum to "0"
    delay 1
end notification_Center

This AppleScript saves a list of all the open tabs in your (frontmost) Chrome window to a new item in DEVONthink Pro – 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 […]

(*
◸ Veritrope.com
Save Chrome Tabs to DEVONthink Pro
VERSION 1.0
June 16, 2014
)

// UPDATE NOTICES
     ** Follow @Veritrope on Twitter, Facebook, Google Plus, and ADN for Update Notices! **

// SUPPORT VERITROPE!
     If this AppleScript was useful to you, please take a second to show your love here:
     http://veritrope.com/support

// SCRIPT INFORMATION AND UPDATE PAGE
     http://veritrope.com/code/save-chrome-tabs-to-devonthink-pro

// REQUIREMENTS
     More details on the script information page.

// CHANGELOG
    1.0  INITIAL RELEASE

// 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.


*)


(*
======================================
// MAIN PROGRAM
======================================
*)


-- PREPARE THE LIST
set url_list to {}
set the date_stamp to ((the current date) as string)
set NoteTitle to "URL List from Chrome Tabs on " & the date_stamp

--PROCESSING FRONTMOST CHROME WINDOW
tell application "Google Chrome"
    activate
    set chromeWindow to the front window
    set tabCount to (count of (tabs of chromeWindow))
    set successCount to 0
   
    --GET TAB INFO
    repeat with w in chromeWindow
        try
            repeat with t in (tabs of w)
                set TabTitle to (title of t)
                set TabURL to (URL of t)
                --set TabInfo to ("" & TabTitle & return & TabURL & return & return)
                set TabInfo to ("<a href=\"" & TabURL & "\">" & TabTitle & "</a><br/>")
                --ADD TO LIST
                copy TabInfo to the end of url_list
               
                --INCREMENT SUCCESS COUNT
                set successCount to (successCount + 1)
            end repeat
        end try
    end repeat
end tell

-- CONVERT URL_LIST TO TEXT
set old_delim to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set url_list to url_list as text
set AppleScript's text item delimiters to old_delim

--MAKE THE ITEM IN DEVONthink Pro  
tell application "DEVONthink Pro"
   
    create record with {type:html, source:url_list, name:NoteTitle} in current group
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 Chrome Tabs to DEVONthink Pro" subtitle "◸ Veritrope.com"
       
    else if Plural_Test is 0 then
        display notification "No Tabs Exported!" with title "Send Chrome Tabs to DEVONthink Pro" subtitle "◸ Veritrope.com"
       
    else if Plural_Test is equal to 1 then
        display notification "Successfully Exported " & itemNum & ¬
            " Tab to DEVONthink Pro" with title "Send Chrome Tabs to DEVONthink Pro" subtitle "◸ Veritrope.com"
       
    else if Plural_Test is greater than 1 then
        display notification "Successfully Exported " & itemNum & ¬
            " Tabs to DEVONthink Pro" with title "Send Chrome Tabs to DEVONthink Pro" subtitle "◸ Veritrope.com"
    end if
   
    set itemNum to "0"
    delay 1
end notification_Center

Updated on July 17, 2013 This script exports an copy of selected DEVONthink items and saves them into Evernote, applying the Group Name in DEVONthink as a tag in Evernote. To use it, just highlight the items in DEVONthink that you want to send to Evernote and run the script! Moving Items By Script Vs. […]

(*
http://veritrope.com
DEVONthink to Evernote Exporter
VERSION 1.5
July 17, 2013

// 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

// IMPORTANT LINKS:
-- Project Page: http://veritrope.com/code/devonthink-to-evernote-export
-- FastScripts (Optional): http://bit.ly/FastScripts

// INSTALLATION:  
-- You can save this script to /Library/Scripts/ and launch it using the system-wide script menu from the Mac OS X menu bar. (The script menu can be activated using the AppleScript Editor application).
-- To use, highlight the items you want to move into Evernote and run this script file;
-- The "User Switches" below allow you to customize the way this script works.

    (Optional but recommended)
    Easier Keyboard Shortcut with FastScripts
    -- Download and Install FastScripts here:
    -- http://bit.ly/FastScripts

// CHANGELOG:
1.50     Simplified handling of record type doesn't depend on localization anymore, is more flexible and supports all types including formatted notes. In addition, the error handling has been improved, e.g. in case of unsupported/too large files. (Christian Grunenberg)
1.40     BUG FIXES (CREATING NOTES FROM FILES), MISC. DIALOG TWEAKS
1.32     ADDED NOTE CREATION DATE TRANSFER
1.31     FIX FOR LONG TITLES (THANK YOU, WES COWLEY!)
1.30     TEMPORARILY REMOVED GROWL
1.22     INCORPORATED CHRISTIAN GRUNENBERG'S TAG FIX
1.21    TEMP WORK-AROUND FOR TAGGING ISSUE
1.20    MISCELLANEOUS CHANGES
1.10    FILE DETECTION AND OTHER BUG FIXES
1.00    INITIAL RELEASE

*)


(*
======================================
// USER SWITCHES (YOU CAN CHANGE THESE!)
======================================
*)


--CHANGE THIS TO DESIRED DEFAULT TAG
property defaultTag : "From DEVONthink Pro"

(*
======================================
// OTHER PROPERTIES (USE CAUTION WHEN CHANGING)
======================================
*)


property theNum : "0"
property EVnotebook : ""
property thename : ""
property theNotes : ""
property theBody : ""
property theURL : ""

(*
======================================
// MAIN PROGRAM
======================================
*)


tell application id "com.devon-technologies.thinkpro2"
    set theNum to 0
    try
        set this_selection to the selection
        if this_selection is not {} then
            set EVnotebook to my Notebook_List()
            repeat with this_item in this_selection
                set theType to type of this_item
                set theRichText to (the rich text of this_item)
               
                set thename to (the name of this_item)
                --LONG TITLE FIX (WES COWLEY)
                if length of thename > 254 then set thename to (characters 1 thru 254 of thename) as string
               
                set theURL to (the URL of this_item)
                set theText to (the rich text of this_item)
                set theSource to (the source of this_item)
                set thePath to (the path of this_item)
                set creDate to (the creation date of this_item)
                set modDate to (the modification date of this_item)
                if exists tags of this_item then
                    set theTags to (the tags of this_item)
                else
                    set theTags to defaultTag
                end if
               
                set n to missing value
               
                -- CREATE THE NOTE FROM ITEM
                if theType is PDF document or theType is picture or theType is unknown or (theType as string) is "quicktime" then
                    tell application "Evernote" to set n to create note from file (POSIX file thePath) ¬
                        title thename ¬
                        notebook EVnotebook ¬
                        tags theTags
                else if theType is webarchive or theType is html or theType is formatted note or theType is sheet then
                    tell application "Evernote" to set n to create note with html theSource ¬
                        title thename ¬
                        notebook EVnotebook ¬
                        tags theTags
                else if theType is bookmark then
                    tell application "Evernote" to set n to create note from url theURL ¬
                        title thename ¬
                        notebook EVnotebook ¬
                        tags theTags
                else if theType is rtf or theType is rtfd then
                    tell application "Evernote" to set n to create note with text theRichText ¬
                        title thename ¬
                        notebook EVnotebook ¬
                        tags theTags
                else if theType is txt or theType is script then
                    tell application "Evernote" to set n to create note with text theText ¬
                        title thename ¬
                        notebook EVnotebook ¬
                        tags theTags
                else if theType is plist or theType is xml then
                    tell application "Evernote" to set n to create note with text (theSource as text) ¬
                        title thename ¬
                        notebook EVnotebook ¬
                        tags theTags
                end if
               
                if n is not missing value then
                    tell application "Evernote"
                        set source URL of n to theURL
                        set creation date of n to creDate
                        set modification date of n to modDate
                    end tell
                else if theType is not bookmark and theType is not group and theType is not smart group and theType is not feed then
                    error "Couldn't export record \"" & thename & "\"."
                end if
            end repeat
        end if
    on error error_message number error_number
        if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
    end try
end tell

(*
======================================
// UTILITY SUBROUTINES
======================================
*)


--SORT SUBROUTINE
on simple_sort(my_list)
    set the index_list to {}
    set the sorted_list to {}
    repeat (the number of items in my_list) times
        set the low_item to ""
        repeat with i from 1 to (number of items in my_list)
            if i is not in the index_list then
                set this_item to item i of my_list as text
                if the low_item is "" then
                    set the low_item to this_item
                    set the low_item_index to i
                else if this_item comes before the low_item then
                    set the low_item to this_item
                    set the low_item_index to i
                end if
            end if
        end repeat
        set the end of sorted_list to the low_item
        set the end of the index_list to the low_item_index
    end repeat
    return the sorted_list
end simple_sort

(*
======================================
// MAIN HANDLER SUBROUTINES
======================================
*)


--EVERNOTE NOTEBOOK SELECTION SUBROUTINE
on Notebook_List()
    tell application "Evernote"
        activate
        set listOfNotebooks to {} (*PREPARE TO GET EVERNOTE'S LIST OF NOTEBOOKS *)
        set EVNotebooks to every notebook (*GET THE NOTEBOOK LIST *)
        repeat with currentNotebook in EVNotebooks
            set currentNotebookName to (the name of currentNotebook)
            copy currentNotebookName to the end of listOfNotebooks
        end repeat
        set Folders_sorted to my simple_sort(listOfNotebooks) (*SORT THE LIST *)
        set SelNotebook to choose from list of Folders_sorted with title "Select Evernote Notebook For Imported Items" with prompt ¬
            "Current Evernote Notebooks" OK button name "OK" cancel button name "New Notebook" (*USER SELECTION FROM NOTEBOOK LIST *)
        if (SelNotebook is false) then (*CREATE NEW NOTEBOOK OPTION *)
            set userInput to ¬
                text returned of (display dialog "Enter New Notebook Name:" default answer "")
            set EVnotebook to userInput
        else
            set EVnotebook to item 1 of SelNotebook
        end if
    end tell
end Notebook_List