Jump to content
  • 0

(Archived) TIP: Creating an auto-import folder using Folder Actions


geechorama

Idea

Posted

If you want to set up an auto-import folder for the Mac Evernote client, here's what you need to do:

- First up, you want to create the auto-import folder in the Finder. For this guide, we'll create a folder on the Desktop called "Evernote Auto-Import".

- The next step is to enable Folder Actions. Right click on the auto-import folder and choose "Enable Folder Actions":

post-8182-131906062513_thumb.jpeg

- Now, we want to make a script. Create the script using Script Editor and save it in "Library/Scripts/Folder Action Scripts" Our script will look like this:


--
-- Folder Action script to add items to Evernote when they appear in a folder
--

-- after clipping, we'll move files into here
property done_foldername : "Clip Successful"
-- if the clip fails, we'll move files into here
property failed_foldername : "Clip Failed"

on adding folder items to this_folder after receiving these_items
try
-- iterate of files added
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
tell application "Evernote"
-- clip it!
create note from file this_item title "Auto Import " & this_item
end tell
tell application "Finder"
-- make sure our 'success' destination folder exists
if not (exists folder done_foldername of this_folder) then
make new folder at this_folder with properties {name:done_foldername}
end if
set done_folder to folder done_foldername of this_folder
-- move the file we just clipped into our success folder
move this_item to done_folder with replacing
-- all done
end tell
end repeat
on error e
-- uh oh. bad things happened.
tell application "Finder"
-- make sure our 'failed' folder exists
if not (exists folder failed_foldername of this_folder) then
make new folder at this_folder with properties {name:failed_foldername}
end if
set failed_folder to folder failed_foldername of this_folder
-- move the failed file into the failed folder
move this_item to failed_folder with replacing
-- display the error message
display dialog e buttons {"Cancel"} default button 1 giving up after 120
end tell
end try
end adding folder items to

- Finally, link up the folder and the script by right-clicking on the auto-import folder and choosing "Attach a Folder Action..." from the menu:

post-8182-131906062515_thumb.jpeg

Now choose the script we just created, and that's it! Yer ready to go. Drag an image or file into the folder to try it out. If the clip is successful, the file gets moved into a sub-folder called "Clip Successful", and if it fails, it goes into a sub-folder called "Clip Failed" and the Finder will display the error message.

63 replies to this idea

Recommended Posts

  • Level 5*
Posted
To take this one step further, is there a way to designate the notebook in which the note will be created in?

Did you look at Veritrope's link?

Posted

The screenshots / instructions are for an older version of OS X. Anyone out there game to redo this for some noobs like me? Am trying to set up Auto-Import from a folder for my Mac. Thanks

Posted

There are some good scripts here. I made my own to fit some custom requirements I have.

I use Evernote & Dropbox on my iPad and iPhone quite a bit. I also use GoodReader and a few other apps that sling files around that I want to keep in Evernote for various purposes.

I've set up my Mac to run this Folder Action everytime it sees a file in my Dropbox's "Import to Evernote" folder, so wherever I am I can import directly into Evernote regardless of file type to Evernote, then it is there and I can use the iPhone/iPad client to edit the notes to my specifications (e.g. I can add any file type, etc from GoodReader using its any web url download capability on the iPad or iPhone).

It also detects if Evernote is running on my Mac, if it is already running does leaves it running when it is done, if it has to launch it, it closes it, so it cleans up well after itself (it also deletes the file out of the hot folder).

Works really well for what I want it to do. YMMV.

Download the Folder Action from https://www.dropbox.com/s/73wvlz0qq6ykgg0 and edit/assign it to the appropriate folder you'd like to be the hot folder.

Posted

You can just call me "Justin"! ;)

I don't have a version like that but, as always, I am happy to tailor scripts to individual workflows.

If anyone is interested, you can fill out this form with as many specifics as possible:

http://veritrope.com/about-veritrope/custom-scripts-and-workflows/

I'll take a look and get back to you with an estimate.

======================

Back to the published script for a moment -- I've been getting a lot of downloads, but not a lot of comments. Anyone else try it? Thoughts/suggestions/etc. are welcome on the script's page (link in my earlier post), on Twitter, or via the Veritrope.com Contact page!

Posted

Veritrope - do you have a version that would just add to a pre-assigned folder (set within the script) or to the default folder but without the requirement of user input via the dialogs? i have someone adding docs for me via a synced Dropbox folder and I want these docs to go directly to Evernote even when I am not around.

Posted

is there anyway someone could re-upload the latest version and post a d/l link? the links here seem to be expired. thanks!

Posted

Hi,

Could this script be changed so that it would add either "Spotlight comments" or OpenMeta tags as tag information into the new note? Or if possible both :)

I'd prefer OpenMeta anyway, because it's a real tagging environment that is included with the files and not in the .DS_Store....

Posted

Questionon location in evernote & note title.

I was able to edit the script to remove the Auto Import part of hte title but I can't see how to use just hte filename as a title. Is it possible? I see this was asked earlier but no answers I could see.

Second issue, Is there a way to tell evernote where to put the resulting clipping? i.e a specific notebook?

Posted

Hello,

First of all, let me say that this is a great script and ALMOST fits my needs perfectly. My workflow for scanning documents is as follows:

1. My PA puts the document on the scanner and then presses the Scan button.

2. The document is saved into a folder, at which point the application Hazel moves the file to the folder where your script is run as a folder action.

3. The script works perfectly and sorts the file into the Clip Successful folder.

All that is hunky-dory, my problem is that my scanner software only lets me use the same name for each document scanned, if I want to do it automatically that is. There is is no way to sequentially outnumbers to each document. This means that when your script sorts the file into the Clip Successful folder, if the file already exists, it overwrites it.

I would like to keep a copy of my documents separate from Evernote, so you can see why this behaviour would be a problem. Is there any way of modifying the script so that it avoids this problem?

Just FYI, the reasonable needs to be automatic is that I am quadriplegic and therefore cannot fill in different details for each document on a document like document basis.

I hope this makes sense!

Posted

Should this script work in Snow Leopard?

At the point of compiling, I am getting an error message: Expected end of line, etc. but found application constant or consideration. At that point, I can't save it as a .scpt.

Posted

If you're dragging a file, then this is basically the same thing. It can be useful if you have some application (e.g. a scanner) that drops files into a folder, however. This may save you a step.

Posted

I may (and probably am) missing the point here, but how is this different to just dragging the file onto the Evernote icon in the dock?

Posted

Also, everyone, keep in mind that this only auto-imports on Evernote's startup (from what I can tell). So if you send something to that folder while Evernote is open, nothing will happen.

Posted
Why isn't this supported within the program itself? It's unacceptable to pay $45 for a premium account and not have something so basic supported

hear! hear!

First, the post you quoted was posted primarily as spam b/c of the links included in the post (and that you included in your quote) and has been deleted.

Second, I've perused this thread & don't understand what "basic" feature you're saying isn't supported. Admittedly, I didn't read every detail, but AFAIK, import folders are supported on Mac.

  • Level 5*
Posted
Why isn't this supported within the program itself? It's unacceptable to pay $45 for a premium account and not have something so basic supported

hear! hear!

First, the post you quoted was posted primarily as spam b/c of the links included in the post (and that you included in your quote) and has been deleted.

Second, I've perused this thread & don't understand what "basic" feature you're saying isn't supported. Admittedly, I didn't read every detail, but AFAIK, import folders are supported on Mac.

If they are BnF, I can't find them. Nevertheless, it looks like Veritrope's script does exactly the same thing.

Posted
If they are BnF, I can't find them. Nevertheless, it looks like Veritrope's script does exactly the same thing.

Ah, my bad. (Sorry!) Thanks for the correction!

Posted

For those of you trying to create the note with just the name of the file, I just figured out how to do it (replace the "create note" line with this):


create note from file this_item title do shell script "basename " & quoted form of POSIX path of this_item

jessica

Posted

I left Windows for Mac just to avoid this sort of roll-your-own solution, and my guess is that the EN developers recognize this and will bring the Mac version up to the Windows capabilities pretty soon. After all, auto-import is more or less the default method of getting scans into EN Windows.

Posted

I just switched from windows to mac recently and I must say that I'm utterly surprised this feature is not existing in the mac version... is there any plan to introduce it soon?

Posted

If they are BnF, I can't find them. Nevertheless, it looks like Veritrope's script does exactly the same thing.

it does not right? Evernote for windows keeps track of the files dropped in the folder so it only imports the newer ones... this script imports new files into evernote but then it sends the file to the trash :(

Posted

The nice thing about AppleScript is that it's pretty easy to make it do **EXACTLY** what you want it to do! :(

For example -- To keep the script from deleting the files, all you have to do is remove this line of code:


tell application "Finder" to delete added_items

For future revisions of the script, I'll probably include some "switches" to make customization even easier.... but hope this helps for now!

Posted
The nice thing about AppleScript is that it's pretty easy to make it do **EXACTLY** what you want it to do! :)

For example -- To keep the script from deleting the files, all you have to do is remove this line of code:


tell application "Finder" to delete added_items

For future revisions of the script, I'll probably include some "switches" to make customization even easier.... but hope this helps for now!

Hi there,

yeah, I know I know... yesterday evening I spent a couple of hours playing around with your script! :)

But the thing is, I just feel I'm starting to go back to my linux days seeking Evernote for Mac to enable me do things that Evernote for Windows actually does out of the box.

Back when I had Windows XP, I had several "import folder" profiles. I would then have the software of my scanner store the scanned files in one of the watched folders and Evernote would do the rest, keeping track of the things that had already been imported before... I would swear that even if the filename was changed, Evernote would not reimport the file (I'm not sure though), suggesting that Evernote keeps a database somehow I guess...

What I want to say is that you can get really far with scripting, I know (have used debian for years), but I feel somehow that Mac users in this case have been left out for this and other features should be provided by Evernote itself.

Thanks a milion for your extremely helpful script and for your prompt answer (gotto post this very same answer on your original post)

Marc

Posted

I have edited Veritrope's script"

1. removed the dialogue - set Tag to blank and the default notebook to one of my choice

2. added file un-lock function

3. added reset for permissions (will set permission to RW all users)

The file will quietly copy to Evernote without need for your intervention.

You don't need to worry about setting the full access rights to everybody. The file is being copied (not moved) by Evernote and thus inherits proper permissions. You can check it under....

"/Users/__YOUR_USER_NAME__/Library/Application Support/Evernote/external edits/__UNIQUE_FOLDER_NAME__/"

Here is the edited script (note - I am not a programmer and I have only a limited knowledge, so the way I edited the script is not very elegant way)


----------------------------

(*
http://veritrope.com
Folder Action -- Evernote Exporter
Version 1.0
June 7, 2010
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/tips/evernote-desktop-folder
*)
property theNum : "0"
property EVnotebook : ""
property EVTag : ""
property thename : ""
property theNotes : ""
property theBody : ""
property theURL : ""
on adding folder items to this_folder after receiving added_items

(*RESET LOCK *)

tell application "Finder"
set locked of every file of folder this_folder to false
end tell

(*RESENT PERMISSIONS *)

tell application "Finder"
set fold_name to the name of this_folder
try
repeat with i from 1 to number of items in added_items
set new_item to item i of added_items
set the item_path to the quoted form of the POSIX path of new_item
do shell script ("/bin/chmod -R ugo+wr " & item_path)
end repeat
end try
end tell


(*MAIN PROGRAM *)

tell application "Evernote"
--set successCount to 0
set EVTag to ""
set EVnotebook to "NAME_OF_YOUR_DEFAULT_NOTEBOOK"
repeat with i from 1 to number of items in added_items
set new_item to item i of added_items
create note from file new_item notebook EVnotebook tags EVTag
(*DELETE THE TEMP FILE/FOLDER *)
end repeat
end tell

delay 5

tell application "Finder" to delete added_items
end adding folder items to


------------------------------

Posted

I got this to work with my text files (notes exported by Mark/Space Notebook BUT they all have identical subject lines:

"Auto Import Macintosh HD:Users:rnwarbur:Desktop:Evernote Auto-Import:.DS_Store" - which makes them pretty useless

What they SHOULD have as the note title is just the first line of text in the text file.

I see this line in your script that causes the title creation:

create note from file this_item title "Auto Import " & this_item

Can't you change that line so that instead it picks up the first line of text?

Posted

Dear Justin,

 

I have been using your script very successfully. I have an @Evernote folder which now automatically adds content to Evernote. Great.

 

I have set up a folder for a more specific purpose. It is called "@PHOTOS Evernote" and I would like to upload photos to Evernote using this folder.

How can i amend the script to ensure that the folder contents go direct to a folder called "---PHOTOS" in Evernote and do not have the @Evernote tag.

 

Thanks

Posted

i did this. created a folder "Evernote Auto-Import" in my Documents folder.

Enabled folder actions. Created the script that is also stored in Documents/scripts folder (stores as scpt).

And then did the attach script as advised. Attached is an image to show what I did.

But nothing happens after I put files in this folder. No fail, no success! What am I doing wrong?

Image attachment below.

20081113-cnhjpj1qfmtixqwqe4i5g36fsj.jpg

Posted

So, no matter what type of file I attempt to copy into this folder, I get an "Unsupported file type for clipping" error. What are the supported file types for this operation?

Posted

Thanks for the info.

While not quite as useful as I thought it might be, still a nice script.

There are times I get text files that I wish to upload to Evernote. I thought I would just be able to drag copies of these files into this folder and the action would upload it nice and neat rather than opening the file, copying, pasting to Evernote and closing the file.

Any reason this type of functionality couldn't be supported?

Thanks,

Steve

Posted

Hi Steve. Text files should also be handled ok. I just tested this with a file called "Foo.txt" and it works ok. What's the name of the file you're trying to auto-import?

Posted

The filenames varied from "test.sh" to "test.java". I didn't actually try a file with a .txt extension, but rather files that were of type plain text. Is the ability for Evernote to import a note based on the file extension and not the datatype?

Posted

Hmmm. Yeah. Using the 'mdls' command line tool I can see that .java and .sh files both contain the metadata necessary for Evernote to decide that it can import the file:

mdls on a .java file:

kMDItemContentType             = "com.sun.java-source"
kMDItemContentTypeTree = (
"com.sun.java-source",
"public.source-code",
"public.plain-text",
"public.text",
"public.data",
"public.item",
"public.content"
)

mdls on a .sh file:


kMDItemContentType = "public.shell-script"
kMDItemContentTypeTree = (
"public.shell-script",
"public.script",
"public.source-code",
"public.plain-text",
"public.text",
"public.data",
"public.item",
"public.content"
)

I'll file a bug to add support for this metadata.

Posted

This is great, exactly what I was looking for.

One thing - is there a way of creating the note so that it has a title of just the filename? At the moment, I'm getting a really long title along the lines of:

Auto Import Macintosh HD:Users:xxx:Documents:Evernote:filename.pdf

I can see where in the script to deal with the 'Auto Import' part but how do I just get the filename instead of the whole path?

Thanks in advance.

Posted

hmm, how come there is no support for simple plain text file like, .txt? I am askign because I just needed to import some txt files :(

Evernote supports:

html, jpg, gif, png, pdf, wav, mp3

Posted

Actually, plain text files are supported ... we just automatically convert them to HTML internally.

Posted

ohh ok that is great. For a second I thought that there was no txt support.

I have one more question. I have alot of files(over 700) that are text files but they have different extension which I use another app to create. Is there a way to force EN to recognize that format as plain text? They are plain text files, just holding adifferent extension. I can do one time renaming but I am constantly updating those files and adding new ones and I would like to implement those files into EN dynamically.

Posted

Right now, we only use the extension on the file to determine its type. This means that files with a random other extension won't be processed automatically unless you rename them. Like Geech says, we plan to try to expand this behavior a bit in the future, for files that identify themselves as plain text.

Posted

Why isn't this supported within the program itself? It's unacceptable to pay $45 for a premium account and not have something so basic supported.

Posted
Why isn't this supported within the program itself? It's unacceptable to pay $45 for a premium account and not have something so basic supported.

Same reason as always: we haven't had time to fully develop and test it yet. Now that AppleScript support is in, we can work on it.

Posted

Notice that 1.1.6 didn't contain any fixes in this area. What's the current timeframe look like for including this feature? (using data type rather than file extension).

Thanks,

Steve

Posted

I think your folder isn't working because you have the right box filled in. From what I understand, if you put something in that "on" box, the folder action "auto-import", in this case, will only activate once that other script is called.

Simply get rid of that other script, and you should be good.

Also, everyone, keep in mind that this only auto-imports on Evernote's startup (from what I can tell). So if you send something to that folder while Evernote is open, nothing will happen.

Posted

Simply get rid of that other script, and you should be good.

hi. i am afraid i did not understand what you mean when you say get rid of that. i tried un-checking the script "on" option first. that did not work. then i unchecked the folder and checked the script that did not work either. :)

is it possible to restate the steps with more granularity in the "attach script" step?

thanks!

Posted

Yeah...sorry about that. As I was writing it, I thought "what the heck am I saying?"

Anyway, good news. I will restate what I said, and I also finished version 2.0 of my HP 6200 scanner workflow.

To restate my statement:

Why do you have that script in the right box? I have no such thing. Highlight the "send to evernote.scpt" and hit the " - " below that box.

That is all I was saying.

As for version 2.0 of my workflow, HERE it is. Keep in mind each time you login you will need to be sure Folder Actions are enabled. I couldn't figure out how to do that with this workflow (yet). Once you enable it when you login, it will work fine, though.

I hope this helps!

Posted
To restate my statement:

Why do you have that script in the right box? I have no such thing. Highlight the "send to evernote.scpt" and hit the " - " below that box.

I downloaded the workflow. The workflow requires folder options to be enabled right?

Now to enable that I followed the steps posted by the OP. When I follow those steps is when this script gets attached to the folder in question.

In summary, here is what I did.

Created a new folder in Documents folder. Enabled folder options on that folder. Attach script which I saved in Library/scripts/folder options script.

Then I copy a pdf file in that folder and wait for the pdf to be magically imported into evernote.

but no luck :). scanning directly into evernote does not even come into the picture yet...

Posted

Hmmf.

Weird.

Okay, here is what I did step by step. Nothing left out. Nothing simplified.

1. Copy code from this thread.

2. Open Script Editor.

3. Paste code.

4. Compile code.

5. File>Save As

6. Save script in Macintosh HD>Library>Scripts as "Evernote Auto-Import"

7. Make folder in Home>Documents called "Evernote Auto-Import"

8. Right-click this folder

9. More>Attach a Folder Action

10. Select the "Evernote Auto-Import" script.

11. Right-click the folder again.

12. More>Configure Folder Actions.

13. Close that window that pops up.

14. It should work now.

THERE MAY BE SOMETHING MISSING BETWEEN 10 AND 11, I AM NOT SURE.

Did you do anything differently?

P.S.- I see where that script in the right-box comes from. I only get it when I select the script in the left box. Also, mine has the same title as the script on the left.

Posted

As for my problem with needing to re-enable the folder actions with each login (so every time I login I have to re-enable them), I went on to Apple Discussions and seem to have found a solution.

I went to myUsername/Library/Launch and removed these files (trash them)

com.apple.FolderActions.enabled.plist

com.apple.FolderActions.folders.plist

And then logout. Then log back in-add the folder actions (if you need to) again, and then you should be good. I did a quick log-in log-out test to be sure, and it seems to have worked.

Posted

I have finished version 3 of my Automator script. It no longer quits Evernote (due to some new information...something was wrong with my system so I thought this was necessary). It also no longer attempts to open the Evernote Auto-Import folder in Finder (not necessary).

It is available HERE.

Posted

@Lougoose would you be able to re-post your automator script? Seems like the link no longer works :-( thanks and looking forward to using it!

Posted

Yeah, if someone could repost a link to the latest script (looks like version 3) it would be much appreciated. The current links just point the front page of FileDropper. Thanks!

Posted

Is it possible to modify this as a print-to-PDF script so that I can save PDFs to a folder besides the default folder?

Posted

I am a relatively new Mac user and have not been able to quite fully make the adjustment from PC. When I try to follow your directions I am unable to find the "Enable Folder Actions" option. When I right-click on the desktop folder the options I see are included in the attached screen shot (I couldn't figure out how to paste it into my post.

Any assistance would be greatly appreciated.

Thanks,

Michael

post-19213-131906064729_thumb.png

Archived

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

×
×
  • Create New...