Export from Yojimbo to Evernote

Description

Originally published as a blog post, I wanted to move this AppleScript into the Code Library for easier reference.

  • This AppleScript exports a copy of all the selected entries in your Yojimbo database (except those in the Trash) and then imports them into an Evernote notebook.
  • When the script needs to export a file first, it places it into a temporary folder on your Desktop and then deletes it when completed.
  • In addition to facilitating a full export of all your items into Evernote, this script also gives you the option to export items by Collection (i.e., Images, Bookmarks, PDFs).
    Main Archive Window
  • Any tags inside Yojimbo will be added to your imported notes in Evernote. You'll also have a chance to add additional tags to the note on the way in, and you can now select which notebook will receive the import (or create a new one!).
    Tag Window multiple tags
  • When the "Source URL" slot wasn't already being used for a web link, I added clickable URI links that open up your original Yojimbo note.
    URI
  • Automatic Growl detection has also been enabled which will save you a trip to the Script Editor to enable/disable it. As the export completes its transfer of a Collection, Growl users will see a notification window with that collection's icon and the number of items that were transferred. If you're transferring everything all at once, you'll get notifications for each collection so you can track the progress of your export. When the script is complete, it'll give you the final tally via Growl as well.
    Growl CollectionGrowl total

The Code

(*
http://veritrope.com
Yojimbo to Evernote Exporter
Version 1.01
September 16, 2013
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/code/yojimbo-evernote-export

WITH GREAT THANKS TO BRETT KELLY @ BRETTKELLY.ORG FOR THE SCRIPT THAT THIS WAS BASED UPON!

Installation: Just double-click on the script!

FastScripts Installation (Optional, but recommended):
--Download and Install FastScripts from http://www.red-sweater.com/fastscripts/index.html
--Copy script or an Alias to ~/Library/Scripts/Applications/Yojimbo
--Set up your keyboard shortcut

CHANGELOG:

1.01    BUGFIX FOR BOOKMARKS
1.00    INITIAL RELEASE
*)


property theNum : "0"
property TotalNum : "0"
property theKind : ""
property EVnotebook : "default"
property thename : ""
property theNotes : ""
property theBody : ""
property theURL : ""
property criteriaList : {"All Yojimbo Items (FULL EXPORT)", "Notes", "Images", "PDFs", "Bookmarks", "Passwords", "Serial Numbers", "WebArchives"}
property the_Criterion : ""
property doPasswords : true
property doEncryptedNotes : true
property YojimboTitle : ""
property YojimboText : ""
property YojimboSource : ""
property YojimboFile : ""
property YojimboCre : ""
property Yojimbotags : {}
property USERtags : {}
property isRunning : "false"
property GrowlIcon : "Contents/Resources/Yojimbo.icns"
property IconImage : "Contents/Resources/ImageArchiveIcon.png"
property IconNote : "Contents/Resources/NoteIcon.png"
property IconPDF : "Contents/Resources/PDFArchiveIcon.png"
property IconBookmarks : "Contents/Resources/WebBookmarkIcon.png"
property IconPasswords : "Contents/Resources/PasswordIcon.png"
property IconSerialNumbers : "Contents/Resources/SerialNumberIcon.png"
property IconWebArchives : "Contents/Resources/WebArchiveIcon.png"

(* CHECK FOR GROWL *)
if appIsRunning("GrowlHelperApp") then
    set isRunning to true
    tell application "GrowlHelperApp"
        set allNotificationsList to {"Success Notification", "Failure Notification"}
        set enabledNotificationsList to {"Success Notification", "Failure Notification"}
        register as application ¬
            "Yojimbo to Evernote" all notifications allNotificationsList ¬
            default notifications enabledNotificationsList ¬
            icon of application "Yojimbo"
    end tell
end if

(*MAIN PROGRAM *)

(*TEMP FILES PROCESSED ON THE DESKTOP*)
tell application "Finder"
    if (the folder "Temp Export Folder For Evernote" exists) then set FolderLoc to (the folder "Temp Export Folder For Evernote")
    if not (the folder "Temp Export Folder For Evernote" exists) then
        set FolderLoc to (make new folder at (path to desktop folder) with properties {name:"Temp Export Folder For Evernote"})
    end if
    set SaveLoc to FolderLoc as string
end tell

(*PREPARE YOJIMBO*)
tell application "Yojimbo"
    try
        set oldDelims to AppleScript's text item delimiters

        (*SELECT ITEMS TO PROCESS*)
        my chooseArchiveCriteria()

        (*CREATE THE NOTE*)
        my selectedCriterion(the_Criterion, SaveLoc, isRunning)

        (*GROWL COMPLETION*)
        set theNum to TotalNum
        set theKind to "Yojimbo"
        set PathYojimbo to POSIX path of (path to application "Yojimbo")
        set GrowlIcon to "file:///" & PathYojimbo & "/Contents/Resources/Yojimbo.icns"
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
        set TotalNum to 0
        (* ERROR HANDLING *)
    on error errText number errNum
        if isRunning is true then
            if errNum is -128 then
                tell application "GrowlHelperApp" -- GROWL FAILURE FOR ERROR
                    notify with name ¬
                        "Failure Notification" title ¬
                        "User Cancelled" description ¬
                        "Failed to export!" application name "Yojimbo to Evernote"
                end tell
            else
                tell application "GrowlHelperApp" -- GROWL FAILURE FOR ERROR
                    notify with name ¬
                        "Failure Notification" title ¬
                        "Import Failure" description "Failed to export " & theKind & "item due to the following error:  " & errNum & " (" & errText & ¬
                        ")" application name "Yojimbo to Evernote"
                end tell
            end if
        else if isRunning is false then -- NON-GROWL ERROR MSG. FOR ERROR
            display dialog "Item Failed to Import: " & errNum & return & errText with icon 0
        end if
    end try
end tell

(*DELETE THE TEMP FILE/FOLDER *)
tell application "Finder" to delete SaveLoc

(*========================================================*)

(* SUBROUTINES *)
--APP DETECT
on appIsRunning(appName)
    tell application "System Events" to (name of processes) contains appName
end appIsRunning

--EXPORT CRITERION SELECTION
on chooseArchiveCriteria()
    set the_Criterion to ¬
        (choose from list criteriaList default items "All Items in Yojimbo" with title "Yojimbo to Evernote Exporter" with prompt "Which Items to Archive to Evernote?") as string
    if the_Criterion is "false" then error number -128
    return
end chooseArchiveCriteria

--PREFLIGHT INFO
on selectedCriterion(the_Criterion, SaveLoc, isRunning)
    (*SELECT TAGS AND NOTEBOOK*)
    my TagandBag()
    tell application "Yojimbo"
        set yColls to collections whose name is "Library" --GET ALL ITEMS EXCEPT THOSE IN TRASH
        set yimages to every image item in (item 1 of yColls)
        set ybkmks to every bookmark item in (item 1 of yColls)
        set ynotes to every note item in (item 1 of yColls)
        set ypwds to every password item in (item 1 of yColls)
        set ypdfs to every pdf archive item in (item 1 of yColls)
        set yserials to every serial number item in (item 1 of yColls)
        set ywebs to every web archive item in (item 1 of yColls)

        --FULL EXPORT
        if the_Criterion is "All Yojimbo Items (FULL EXPORT)" then
            my AllExportYojimboImages(yimages, SaveLoc, EVnotebook, isRunning, USERtags)
            my AllExportYojimboBookmarks(ybkmks, SaveLoc, EVnotebook, isRunning, USERtags)
            my AllExportYojimboNotes(ynotes, SaveLoc, EVnotebook, isRunning, USERtags)
            my AllExportYojimboPasswords(ypwds, SaveLoc, EVnotebook, isRunning, USERtags)
            my AllExportYojimboPDFs(ypdfs, SaveLoc, EVnotebook, isRunning, USERtags)
            my AllExportYojimboSerials(yserials, SaveLoc, EVnotebook, isRunning, USERtags)
            my AllExportYojimboWeb(ywebs, SaveLoc, EVnotebook, isRunning, USERtags)

            --INDIVIDUAL EXPORT SENDS
        else if the_Criterion is "Images" then
            my AllExportYojimboImages(yimages, SaveLoc, EVnotebook, isRunning, USERtags)

        else if the_Criterion is "Bookmarks" then
            my AllExportYojimboBookmarks(ybkmks, SaveLoc, EVnotebook, isRunning, USERtags)

        else if the_Criterion is "Notes" then
            my AllExportYojimboNotes(ynotes, SaveLoc, EVnotebook, isRunning, USERtags)

        else if the_Criterion is "Passwords" then
            my AllExportYojimboPasswords(ypwds, SaveLoc, EVnotebook, isRunning, USERtags)

        else if the_Criterion is "PDFs" then
            my AllExportYojimboPDFs(ypdfs, SaveLoc, EVnotebook, isRunning, USERtags)

        else if the_Criterion is "Serial Numbers" then
            my AllExportYojimboSerials(yserials, SaveLoc, EVnotebook, isRunning, USERtags)

        else if the_Criterion is "WebArchives" then
            my AllExportYojimboWeb(ywebs, SaveLoc, EVnotebook, isRunning, USERtags)

        end if
    end tell
end selectedCriterion

--"TAGGING AND BAGGING" SUBROUTINE
on TagandBag()
    set defaultTag to "Yojimbo Export"
    display dialog "" & ¬
        "ENTER YOUR TAGS BELOW:" & return & return & "• If items are already tagged in Yojimbo, these tags will be added to them." & return & return & "• Multiple tags are allowed (separate them with commas or colons). " & return & return & ¬
        "• Default Tag is "Yojimbo Export" " with title ¬
        "Yojimbo to Evernote Exporter" default answer defaultTag ¬
        buttons {"Send to Default Notebook", "Select or Create Notebook", "Cancel"} ¬
        default button ¬
        "Send to Default Notebook" cancel button ¬
        "Cancel" with icon path to resource "Evernote.icns" in bundle (path to application "Evernote")
    set dialogresult to the result
    set tagText to text returned of dialogresult
    set ButtonSel to button returned of dialogresult
    set theDelims to {":", ","}
    set USERtags to my Tag_List(tagText, theDelims)
    if ButtonSel is "Select or Create Notebook" then
        set EVnotebook to my Notebook_List()
    end if
end TagandBag

--TAG SELECTION SUBROUTINE
on Tag_List(tagText, theDelims)
    set oldDelims to AppleScript's text item delimiters
    set theList to {tagText}
    repeat with aDelim in theDelims
        set AppleScript's text item delimiters to aDelim
        set newList to {}
        repeat with anItem in theList
            set newList to newList & text items of anItem
        end repeat
        set theList to newList
    end repeat
    return theList
    set AppleScript's text item delimiters to oldDelims
end Tag_List

--EVERNOTE NOTEBOOK SELECTION SUBROUTINE
on Notebook_List()
    tell application "Evernote"
        activate
        (*GET THE NOTEBOOK LIST *)
        set listOfNotebooks to {}
        set EVNotebooks to every notebook
        repeat with currentNotebook in EVNotebooks
            set currentNotebookName to (the name of currentNotebook)
            copy currentNotebookName to the end of listOfNotebooks
        end repeat

        (*SORT THE LIST *)
        set Folders_sorted to my simple_sort(listOfNotebooks)

        (*USER SELECTION FROM NOTEBOOK LIST *)
        set SelNotebook to choose from list of Folders_sorted with title "Yojimbo to Evernote Exporter" with prompt ¬
            "Current Evernote Notebooks" OK button name "OK" cancel button name "New Notebook"

        (*CREATE NEW NOTEBOOK OPTION *)
        if (SelNotebook is false) then
            set userInput to ¬
                text returned of (display dialog "Enter New Notebook Name:" default answer "" with title "Yojimbo to Evernote Exporter" with icon path to resource "Evernote.icns" in bundle (path to application "Evernote"))
            set EVnotebook to userInput
        else
            set EVnotebook to item 1 of SelNotebook
        end if
    end tell
end Notebook_List

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

--IMAGE EXPORT
on AllExportYojimboImages(yimages, SaveLoc, EVnotebook, isRunning, USERtags)
    set theNum to 0
    set PathYojimbo to POSIX path of (path to application "Yojimbo")
    tell application "Yojimbo"
        repeat with yimg in yimages
            set theKind to "image"
            set YojimboFile to (export yimg to file SaveLoc)
            set YojimboTitle to name of yimg
            set YojimboCre to creation date of yimg
            set ytags to tags of yimg
            set NoteID to the id of yimg
            set YojimboSource to "x-yojimbo-item://" & NoteID
            set Yojimbotags to {}
            repeat with t in ytags
                copy the name of t as string to the end of Yojimbotags
            end repeat
            repeat with tg in USERtags
                copy tg as string to the end of Yojimbotags
            end repeat
            my EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
            my ValueReset()
            set theNum to theNum + 1
            set TotalNum to TotalNum + 1
        end repeat
    end tell

    (*NOTIFICATIONS*)
    if isRunning is true then
        set GrowlIcon to "file://" & PathYojimbo & IconImage
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    end if
end AllExportYojimboImages

--BOOKMARK EXPORT
on AllExportYojimboBookmarks(ybkmks, SaveLoc, EVnotebook, isRunning, USERtags)
    tell application "Yojimbo"
        set PathYojimbo to POSIX path of (path to application "Yojimbo")
        set theNum to 0
        repeat with ybk in ybkmks
            set theKind to "bookmark"
            set YojimboSource to location of ybk
            set YojimboTitle to name of ybk
            set YojimboCre to creation date of ybk
            set bTags to tags of ybk
            if comments of ybk is not missing value then
                set YojimboText to comments of ybk
            else
                set YojimboText to location of ybk
            end if
            set Yojimbotags to {}
            repeat with t in bTags
                copy the name of t as string to the end of Yojimbotags
            end repeat
            repeat with tg in USERtags
                copy tg as string to the end of Yojimbotags
            end repeat
            my EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
            my ValueReset()
            set theNum to theNum + 1
            set TotalNum to TotalNum + 1
        end repeat
    end tell

    (*NOTIFICATIONS*)
    if isRunning is true then
        set GrowlIcon to "file:///" & PathYojimbo & IconBookmarks
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    end if
end AllExportYojimboBookmarks

--NOTE EXPORT
on AllExportYojimboNotes(ynotes, SaveLoc, EVnotebook, isRunning, USERtags)
    set PathYojimbo to POSIX path of (path to application "Yojimbo")
    set theNum to 0
    tell application "Yojimbo"
        repeat with ynt in ynotes
            set theKind to "note"
            --if doEncryptedNotes and ynt is encrypted then
            set YojimboTitle to name of ynt
            set YojimboCre to creation date of ynt
            set nTags to tags of ynt
            set nProps to the properties of ynt
            set NoteID to the id of ynt
            set YojimboSource to "x-yojimbo-item://" & NoteID
            set YojimboFile to (export ynt to file SaveLoc)
            set YojimboText to contents of nProps
            set Yojimbotags to {}
            repeat with tg in nTags
                copy the name of tg as string to the end of Yojimbotags
            end repeat
            repeat with tg in USERtags
                copy tg as string to the end of Yojimbotags
            end repeat
            my EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
            my ValueReset()
            set theNum to theNum + 1
            set TotalNum to TotalNum + 1
        end repeat
    end tell

    (*NOTIFICATIONS*)
    if isRunning is true then
        set GrowlIcon to "file:///" & PathYojimbo & IconNote
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    end if
end AllExportYojimboNotes

--PASSWORD EXPORT
on AllExportYojimboPasswords(ypwds, SaveLoc, EVnotebook, isRunning, USERtags)
    set theNum to 0
    tell application "Yojimbo"
        set PathYojimbo to POSIX path of (path to application "Yojimbo")
        repeat with ypwd in ypwds
            set theKind to "password"
            set doPasswords to true
            set YojimboTitle to name of ypwd
            set YojimboCre to creation date of ypwd
            set nTags to tags of ypwd
            set nProps to the properties of ypwd
            set nLocation to the location of ypwd
            set NoteID to the id of ypwd
            set YojimboSource to "x-yojimbo-item://" & NoteID
            set nAcct to the account of ypwd
            if doPasswords then
                try
                    set nPass to the password of ypwd
                on error
                    set nPass to "<security Policy Enforced, Password not Imported>"
                end try
            else
                set nPass to "<password Omitted>"
            end if
            set YojimboText to ""
            if nLocation is not missing value then
                set YojimboText to (YojimboText & "Location: " & nLocation & return)
            end if
            if nAcct is not missing value then
                set YojimboText to (YojimboText & "Account: " & nAcct & return)
            end if
            set YojimboText to (YojimboText & return & "Password: " & nPass)
            set Yojimbotags to {}
            repeat with tg in nTags
                copy the name of tg as string to the end of Yojimbotags
            end repeat
            repeat with tg in USERtags
                copy tg as string to the end of Yojimbotags
            end repeat
            my EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
            my ValueReset()
            set theNum to theNum + 1
            set TotalNum to TotalNum + 1
        end repeat
    end tell

    (*NOTIFICATIONS*)
    if isRunning is true then
        set GrowlIcon to "file:///" & PathYojimbo & IconPasswords
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    end if
end AllExportYojimboPasswords

--PDF EXPORT
on AllExportYojimboPDFs(ypdfs, SaveLoc, EVnotebook, isRunning, USERtags)
    set theNum to 0
    tell application "Yojimbo"
        set PathYojimbo to POSIX path of (path to application "Yojimbo")
        activate
        repeat with ypdf in ypdfs
            set theKind to "PDF"
            set YojimboFile to (export ypdf to file SaveLoc)
            set YojimboTitle to name of ypdf
            set YojimboCre to creation date of ypdf
            set ypdfTags to tags of ypdf
            set NoteID to the id of ypdf
            set YojimboSource to "x-yojimbo-item://" & NoteID
            set Yojimbotags to {}
            repeat with t in ypdfTags
                copy the name of t as string to the end of Yojimbotags
            end repeat
            repeat with tg in USERtags
                copy tg as string to the end of Yojimbotags
            end repeat
            my EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
            my ValueReset()
            set theNum to theNum + 1
            set TotalNum to TotalNum + 1
        end repeat
    end tell

    (*NOTIFICATIONS*)
    if isRunning is true then
        set GrowlIcon to "file:///" & PathYojimbo & IconPDF
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    end if
end AllExportYojimboPDFs

--SERIAL NUMBER EXPORT
on AllExportYojimboSerials(yserials, SaveLoc, EVnotebook, isRunning, USERtags)
    set theNum to 0
    tell application "Yojimbo"
        set PathYojimbo to POSIX path of (path to application "Yojimbo")
        repeat with yserial in yserials
            set theKind to "serial number"
            set YojimboTitle to name of yserial
            set YojimboCre to creation date of yserial
            set nTags to tags of yserial
            set nProps to the properties of yserial
            set nOwner to the owner name of yserial
            set nEmail to the email address of yserial
            set nOrg to the organization of yserial
            set nSerial to the serial number of yserial
            set NoteID to the id of yserial
            set YojimboSource to "x-yojimbo-item://" & NoteID
            set YojimboText to ""
            if nOwner is not missing value and nOwner is not "" then
                set YojimboText to YojimboText & "Owner: " & nOwner & return
            end if
            if nEmail is not missing value and nEmail is not "" then
                set YojimboText to YojimboText & "Email Address: " & nEmail & return
            end if
            if nOrg is not missing value and nOrg is not "" then
                set YojimboText to YojimboText & "Organization: " & nOrg & return
            end if
            if nSerial is not missing value and nSerial is not "" then
                set YojimboText to YojimboText & "Serial Number: " & nSerial & return
            end if
            set Yojimbotags to {}
            repeat with tg in nTags
                copy the name of tg as string to the end of Yojimbotags
            end repeat
            repeat with tg in USERtags
                copy tg as string to the end of Yojimbotags
            end repeat
            my EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
            my ValueReset()
            set theNum to theNum + 1
            set TotalNum to TotalNum + 1
        end repeat
    end tell

    (*NOTIFICATIONS*)
    if isRunning is true then
        set GrowlIcon to "file:///" & PathYojimbo & IconSerialNumbers
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    end if
end AllExportYojimboSerials


--WEBARCHIVE EXPORT
on AllExportYojimboWeb(ywebs, SaveLoc, EVnotebook, isRunning, USERtags)
    set theNum to 0
    tell application "Yojimbo"
        set PathYojimbo to POSIX path of (path to application "Yojimbo")
        repeat with yweb in ywebs
            set theKind to "webarchive"
            set YojimboTitle to name of yweb
            set YojimboCre to creation date of yweb
            set YojimboFile to (export yweb to file SaveLoc)
            set nTags to tags of yweb
            set nProps to the properties of yweb
            set YojimboSource to the source URL of yweb
            set nBody to the source URL of nProps
            set Yojimbotags to {}
            repeat with tg in nTags
                copy the name of tg as string to the end of Yojimbotags
            end repeat
            repeat with tg in USERtags
                copy tg as string to the end of Yojimbotags
            end repeat
            my EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
            my ValueReset()
            set theNum to theNum + 1
            set TotalNum to TotalNum + 1
        end repeat
    end tell

    (*NOTIFICATIONS*)
    if isRunning is true then
        set GrowlIcon to "file:///" & PathYojimbo & IconWebArchives
        my GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    end if
end AllExportYojimboWeb

--CREATE THE NOTE IN EVERNOTE
on EVNoteCreate(YojimboText, YojimboFile, YojimboTitle, YojimboCre, Yojimbotags, YojimboSource, EVnotebook)
    tell application "Evernote"
        try
            if EVnotebook is "default" and YojimboFile is not "" then --File to Default Notebook
                set EVNote to (create note from file YojimboFile title YojimboTitle created YojimboCre tags Yojimbotags)
                set source URL of EVNote to YojimboSource
            else if EVnotebook is not "default" and YojimboFile is not "" then --File to Selected Notebook
                set EVNote to (create note from file YojimboFile title YojimboTitle created YojimboCre notebook EVnotebook tags Yojimbotags)
                set source URL of EVNote to YojimboSource
            else if EVnotebook is "default" and YojimboFile is "" and YojimboSource is not "" and YojimboText is "" then --URL to Default Notebook
                set EVNote to (create note from url YojimboSource title YojimboTitle created YojimboCre tags Yojimbotags)
            else if EVnotebook is not "default" and YojimboFile is "" and YojimboSource is not "" and YojimboText is "" then --URL to Selected Notebook
                set EVNote to (create note from url YojimboSource title YojimboTitle created YojimboCre tags Yojimbotags notebook EVnotebook)
            else if EVnotebook is "default" and YojimboSource is not "" and YojimboText is not "" then --Bookmark to Default Notebook
                set EVNote to (create note with text YojimboText title YojimboTitle created YojimboCre tags Yojimbotags)
                set source URL of EVNote to YojimboSource
            else if EVnotebook is not "default" and YojimboSource is not "" and YojimboText is not "" then --Bookmark to Selected Notebook
                set EVNote to (create note with text YojimboText title YojimboTitle created YojimboCre tags Yojimbotags notebook EVnotebook)
                set source URL of EVNote to YojimboSource
            else if EVnotebook is "default" and YojimboSource is "" and YojimboText is not "" then --Text to Default Notebook
                set EVNote to (create note with text YojimboText title YojimboTitle created YojimboCre tags Yojimbotags)
                set source URL of EVNote to YojimboSource
            else if EVnotebook is not "default" and YojimboSource is "" and YojimboText is not "" then --Text to Selected Notebook
                set EVNote to (create note with text YojimboText title YojimboTitle created YojimboCre tags Yojimbotags notebook EVnotebook)
                set source URL of EVNote to YojimboSource
            end if
        end try
    end tell
end EVNoteCreate

--RESET VALUES AFTER NOTE CREATION
on ValueReset()
    set YojimboText to ""
    set YojimboFile to ""
    set YojimboTitle to ""
    set YojimboCre to ""
    set YojimboSource to ""
end ValueReset

--GROWL
on GrowlNotify(the_Criterion, theNum, theKind, GrowlIcon)
    tell application "GrowlHelperApp" -- GROWL SUCCESS
        set Plural_Test to (theNum) as number
        if (the_Criterion is not false) and Plural_Test is greater than 1 then
            notify with name ¬
                "Success Notification" title ¬
                "Import Success" description "Successfully exported " & theNum & " " & theKind & ¬
                " items to the " & EVnotebook & " notebook in Evernote" application name ¬
                "Yojimbo to Evernote" image from location GrowlIcon

        else if (the_Criterion is not false) and Plural_Test is equal to 1 then
            notify with name ¬
                "Success Notification" title ¬
                "Import Success" description "Successfully exported " & theNum & " " & theKind & ¬
                " item to the " & EVnotebook & " notebook in Evernote" application name ¬
                "Yojimbo to Evernote" image from location GrowlIcon
        end if
    end tell
end GrowlNotify

3 Responses to “Export from Yojimbo to Evernote”

  1. Type11 December 27, 2013 at 10:01 am #

    Humm when I run I get Expected class name but found identifier. and it calls out set EVNotebooks to every notebook

  2. John Smith June 24, 2014 at 4:23 pm #

    The “Automatic Growl Detection” doesn’t work. The script will not compile if Growl is not installed on your system; it pops up a “where is GrowlHelper?” dialog and if you cancel it, the script bombs out.

    Maybe you could remove the growl requirement from all your scripts, and just use friendlier dialogs, especially since OS X has Notification Center now? I excised every use of the world “growl” from the script and now it works well, but you may want to test your scripts on a machine WITHOUT Growl installed to see whether it works or not 😉

    • Justin Lancy June 24, 2014 at 10:22 pm #

      This is a pretty old script and lots of things have changed since I originally wrote it: GROWL was updated, the advent of Notification Center and–perhaps most crucially–I no longer have a copy of Yojimbo to test it with. 😉

      Feel free to send me your “GROWL-Free” revision and I’ll post it here!