Jump to content

Archived

This topic is now archived and is closed to further replies.

r1chyo

mac (Archived) Evernote Applescript expertise required!

Recommended Posts

Hi all,

Hoping one of you Evernote/Applescript gurus can help out here as Im getting desperate! Thought I'd be able to achieve this in automator, but probably not after all…

The issue:

I have been using a finder folder structure to locally store loads of stuff Ive scanned in over time. I started uploading the items to Evernote for the OCR and easy search. For each file uploaded (all to the same notebook) I've used the names of all the folders it belongs to as the tags for that item. So if the following file was located in the finder as:

Home/Documents/Evernote/House_stuff/plans/File1.pdf

Then I would manually upload it to "Notebook1" and tag with "Evernote", "House_stuff" and "plans".

The only issue was that I was running into the upload limit - as a result I haven't done it for ages and now I have an enormous backlog of files to sort out and upload. I have however helpfully "tagged" each file that hasn't yet been uploaded by preceding them with a `. So, I have loads of files stashed away deep in folders like:

Home/Documents/Evernote/House_stuff/plans/ `File1.pdf

I am guessing that this would be a task ideally suited to automation via AppleScript - unfortunately , I have only got a rudimentary knowledge! Can anyone help please?!! The workflow would be:

- starting at the Evernote folder level, search inside all the folders and subfolders for all files preceded with a `

- once found, upload to notebook1 (minus the preceding ` character) and tag with all relevant folder names as described above

- rename the original, local file to remove the preceding ` so it is clear that it has been uploaded

- ensure that the upload limit is not going to be breached before each upload to avoid issues!

Anyone up for the challenge? Would really appreciate some pointers if anyone can help.

Many thanks,

Rich.

Share this post


Link to post

Do you still need this? I've got a script already that does something similar.

Share this post


Link to post

Here you go. Went ahead and made the tweaks. This will take a folder tree and upload them just as you suggested. You'll need to update the inputPath in the script appropriately for the folder you want to upload.

 

This will not check your upload limit. No way to see that. Nor will it rename files before uploading them to Evernote. If you want to get around that, you'll probably want to duplicate your folder structure, break it up into "bite sized" chunks, etc. Kind of outside of my AppleScript spare time. :)

 

 

 

property inputPath : "Macintosh HD:Users:nikft:Downloads:Scans:"tell application "Finder"    set theFiles to (every file of (entire contents of folder inputPath)) as alias list    set sourcePathLength to (length of inputPath) + 1    set oldTIDs to (AppleScript's text item delimiters)    set AppleScript's text item delimiters to {":"}    repeat with aFile in theFiles        if name of aFile begins with "`" then            set aFilePath to aFile as text            get text sourcePathLength through (length of aFilePath) of aFilePath            set pathItems to text items of result            set targetNotebook to item 1 of pathItems            log targetNotebook            set targetTags to items 2 through ((count of items of pathItems) - 1) of pathItems            tell application "Evernote"                create note from file aFile notebook targetNotebook tags targetTags            end tell        end if    end repeatend tell 

Share this post


Link to post

Hi there - I had truly given up on ever getting a response, so many many thanks for trying this out!

 

Ive tried the script, but it stops with an error. This is what I get so far:

 

 

tell application "Finder"


    get every file of entire contents of folder "SSD:Users:Rich:Documents:_My Stuff:Cars:"


        --> {alias "SSD:Users:Rich:Documents:_My Stuff:Cars:`Car Sales.rtf", alias "SSD:Users:Rich:Documents:_My Stuff:Cars:`Cars.rtf", alias "SSD:Users:Rich:Documents:_My Stuff:Cars:`Cars.xls"}


    get name of alias "SSD:Users:Rich:Documents:_My Stuff:Cars:`Car Sales.rtf"


        --> "`Car Sales.rtf"


    (*`Car Sales.rtf*)


Result:


error "Can’t get items 2 thru 0 of {\"`Car Sales.rtf\"}." number -1728 from items 2 thru 0 of {"`Car Sales.rtf"}

 

Any thoughts? Dont know why its saying 2 through 0 - shouldnt it be 2 through 6 or 7??

 

Many thanks,

 

Rich.

Share this post


Link to post

I'm guessing your inputPath is the "_My Stuff:Cars:" folder. What it's doing is checking that directory for directories to import as notebooks. So instead of finding a "Notebook" folder in the inputPath, it's picking up files, which it doesn't know what to do with.

 

So you want your input folder to contain nothing except for folders to use for notebook names. Something like...

 

Input Folder:

 

Input Folder:Cars:

Input Folder:Finances:

Input Folder:Recipes:

 

Or, to be more precise, something like...

 

Input Folder:Notebook Name:[Tag 1:Tag 2:...TagN:]File.txt

 

Does that make sense?

 

So what you might want is to set _My Stuff as the input folder (which would import everything into the "Cars" notebook), but make sure that the folders in there are set up like the above example.

Share this post


Link to post
Guest
This topic is now closed to further replies.

×
×
  • Create New...