Export from Yojimbo to Evernote with AppleScript

Tags: , , , ,

Change Log:

  • 1.00 (October 15, 2009) INITIAL RELEASE OF SCRIPT

My fellow AppleScript ninjas (or since we’re talking about “Yojimbo”…AppleScript Samurai) — Dive in to the code and, if you have any suggestions or problems, please let me know about them in the comment thread below.

And remember:

  1. These scripts are being provided for the benefit of the Mac community. While they work wonderfully for me, I cannot take responsibility for any data you might lose (or if your laptop turns into a pumpkin or something…);
  2. “Community” means “participation”. Please share with the rest of us *how* you use these scripts in your workflow, how you think they could be improved (and feel free to help someone if they don’t understand something!)

(*
http://veritrope.com
Yojimbo to Evernote Exporter
Version 1.0
October 15, 2009
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/tips/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.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 AllExportYojimboImages(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</password></security>

CLICK HERE TO DOWNLOAD

Was this script helpful to you? Please Donate!


Found a bug in the script?

Click Here To Submit Your Bug Report!

Is there a script to do the reverse?

Click here for the Evernote to Yojimbo Script!

Interested in what other scripts are available for Evernote?

Click here to see the latest list!

Export from Yojimbo to Evernote with AppleScript

Pages: 1 2

14 Comments / Jump to comment form

14 Responses to “Export from Yojimbo to Evernote with AppleScript”

  1. Bill Morgan Bill Morgan says:

    Does this script require Yojimbo 2, or will it work with 1.5? I’ve been looking for a way to pry my data out of Yojimbo for many months now. Thanks!

    • Justin Justin says:

      That’s actually a question I don’t have an answer for! (When I developed the script, I used Yojimbo 2)

      Anyone successfully using this with version 1.5?

  2. Twitter Comment


    Ohhh, so happy for the Yojimbo to @Evernote export script. [link to post] The Mac community is as great as Apple Script is.

    Posted using Chat Catcher

  3. speedmccoy speedmccoy says:

    This worked with Yojimbo 1.5 running on Leopard 10.5.x. Thank you for the script. – Tom

  4. Twitter Comment


    Evernoteハンドブック読んでたら、Yojimboになんでもかんでも取り込んでたのと同じ感覚でやればいいのか?との考えに至り、とりあえずYojimboからEvernoteへエクスポート [link to post]

    Posted using Chat Catcher

  5. Tim Tim says:

    beware that if you have titles of your Yojimbo notes that are longer than 255 characters Evernote will take them, but then you will get “Multiple Validation Errors” and you will not be able to save them nor sync. This script was fantastic, but I had to adjust it to truncate the longer titles on my notes before I could load them.

    • Justin Justin says:

      Hi Tim,

      You are absolutely right! That’s something I discovered on one of my other Evernote scripts…. And forgot to add back into this one! :(

      Thanks for the reminder — and I’m glad that you’re enjoying it!

  6. Andy Andy says:

    I keep getting this error: Import Failure: Failed to export item due to the following error: -1728 )Yojimbo got an error: Can’t get every class YImg of library). Any clue?

  7. Andy Andy says:

    nevermind. I just downloaded the yojimbo 2 demo and after doing that, the export worked. I was at 1.4.2 before. Thanks!

  8. Does this work on password protected items as well?
    Thanks
    S

    • Justin Justin says:

      Hi Sena,

      I am currently “on the road”, so I am going to have to try to answer your question from memory (always a dangerous proposition! ;) )

      There is a bit of code in there to deal with password protected items, but my recollection is that there was some issue with it and that I commented it out until I could properly debug it.

      Of course, I might be remembering things incorrectly — so feel free to give it a shot and to let me know what happens! And if you’re handy with AppleScript, feel free to roll up your sleeves and share some code here in the comments to get the ball rolling!

      Best,
      Justin

      • Hi Justin,

        Thanks for the reply. I gave it a go and it worked for most but not all of my protected items though some of the problems could have been with a timeout.

        In the end I decrypted everything in Yojimbo before doing the import. I’ll now selectively encrypt some notes and passwords.

        Cheers for getting me this far
        S

  9. Channing Channing says:

    Is there a way to add the exporting of the comment field in the Password and Serial notes? As it stands those fields are forgotten – thus losing in my case a lot of valuable info.

rss Subscribe to Comments RSS Feed

Tweetbacks

  1. Twitter Comment


    Check it: [link to post]

    Posted using Chat Catcher

  2. Twitter Comment


    1013 Yojimbo items successfully exported to @evernote. Huge thanks for @Veritrope for his fantastic export AppleScript [link to post]

    Posted using Chat Catcher

  3. Twitter Comment


    Since I like having my data in 3 places and live inside of Yojimbo — a script for getting yojimbo data into Evernote [link to post]

    Posted using Chat Catcher


Trackbacks/Pingbacks

  1. Export from Evernote to Yojimbo with AppleScript | Veritrope
  2. Links to Evernote Applescripts and Accessories-- Updated Regularly! | Veritrope
  3. Export from Evernote to Yojimbo | Veritrope

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>