SteveJam 7 Posted March 19, 2017 Share Posted March 19, 2017 Folks, After a short stint away from EN during the turmoil of the past few months, have decided to return to the fold. Have several hundred text documents and PDFs which I need to import to EN. Dragging them into EN gives them a creation date of Today. Is there some way to import them which can respect the creation date? I *do not* want to do this manually. Steve J Link to comment
Level 5* DTLow 5,744 Posted March 19, 2017 Level 5* Share Posted March 19, 2017 17 minutes ago, SteveJam said: Is there some way to import them which can respect the creation date? I *do not* want to do this manually. Applescript to get the file and creation date from Finder, and import the file to Evernote When the note is created, attributes like creation date can be set Link to comment
SteveJam 7 Posted March 19, 2017 Author Share Posted March 19, 2017 Any ready-made Applescripts out there? Wouldn't have a clue how to create one. Link to comment
Level 5* DTLow 5,744 Posted March 19, 2017 Level 5* Share Posted March 19, 2017 1 hour ago, SteveJam said: Any ready-made Applescripts out there? Wouldn't have a clue how to create one. Here's something I whipped up to get you started Import_Files.scpt I have not done extensive testing Download the file to your Mac double click the file to run Script Editor edit the folder name click on run tell application "Finder" set theFiles to files of folder POSIX file ("/Users/david/Desktop/test") <<< hard coded folder name repeat with theFile in theFiles if name of theFile as string is not ".DS_Store" then set theCreationDate to creation date of theFile set theFile to "/Users/david/Desktop/test/" & name of theFile <<< hard coded folder name tell application "Evernote" set theNote to create note from file theFile <<< create the note set creation date of theNote to theCreationDate <<< set the creation date end tell end if end repeat end tell Link to comment
SteveJam 7 Posted March 19, 2017 Author Share Posted March 19, 2017 DTLow, So I replace "/Users/david/Desktop/test" in both locations in the script with the location of the folder of my choice on the Desktop? E.g.: /Users/MeTheUser/Desktop/TESTimportEN If I do this, I get the error: Error Number: 3 Evernote got an error: File does not exist. SteveJ set theFiles to files of folder POSIX file ("/Users/david/Desktop/test") <<< hard coded folder name Link to comment
Level 5* DTLow 5,744 Posted March 19, 2017 Level 5* Share Posted March 19, 2017 12 minutes ago, SteveJam said: E.g.: /Users/MeTheUser/Desktop/TESTimportEN If I do this, I get the error: I changed the name of my folder tp TESTimportEN and it works for me Are you sure about MeTheUser One thing I should have mentioned - I download the Evernote app from Evernote There are reports the App Store version has issues Link to comment
SteveJam 7 Posted March 19, 2017 Author Share Posted March 19, 2017 MeTheUser: not the real one. Just didn't want to put my name in there. And have the non-App Store version. Add_Notes_to_Evernote_c_Creation_Date.pdf Link to comment
Level 5* DTLow 5,744 Posted March 19, 2017 Level 5* Share Posted March 19, 2017 11 minutes ago, SteveJam said: MeTheUser: not the real one. Just didn't want to put my name in there. Just to doublecheck the file name Right Click on the folder, hold down the option key, Click on Copy xxxx as pathname Link to comment
SteveJam 7 Posted March 19, 2017 Author Share Posted March 19, 2017 Yes. Did that - that's how I got the Unix path. Still getting the same error. Link to comment
Level 5* DTLow 5,744 Posted March 19, 2017 Level 5* Share Posted March 19, 2017 4 hours ago, SteveJam said: Yes. Did that - that's how I got the Unix path. Still getting the same error. If you PM me the script you're running I'll check it out Link to comment
jd007 0 Posted March 19, 2017 Share Posted March 19, 2017 @DTLow I just tried it and got the same error error "Evernote got an error: File does not exist." number 3 Link to comment
jd007 0 Posted March 19, 2017 Share Posted March 19, 2017 @DTLow I found this script which works for me: https://gist.github.com/mshk/6276780 I then modified it to add a tag, and create a new Notebook in Evernote, i.e.: set listOfNames to {} set theFolder to choose folder "Select the source folder" tell application "Finder" set filelist to every file of the folder theFolder repeat with currentFile in filelist set currentFileName to (the name of currentFile) set nom to currentFileName if text -4 of nom is "." then set currentFileName to (text 1 thru -5 of nom) end if set currentFileDate to (the creation date of currentFile) set modFileDate to (the modification date of currentFile) set currentFileLocation to currentFile as alias set currentFileFolder to (the name of theFolder) tell application "Evernote" set theItem to create note title currentFileName tags ["imported_from_Notes"] created currentFileDate notebook "Imported From Notes" from file currentFileLocation set (modification date of theItem) to modFileDate end tell end repeat end tell Link to comment
JonasR 0 Posted July 6, 2018 Share Posted July 6, 2018 On 3/19/2017 at 3:09 PM, jd007 said: @jd007 Thanks for the script, which worked nicely. I just made one modification: Quote set theItem to create note title currentFileName tags ["imported_from_Notes"] created currentFileDate notebook "Imported From Notes" from file currentFileLocation set theItem to create note title currentFileName tags ["imported_from_Notes"] created currentFileDate notebook currentFileFolder from file currentFileLocation This way, I was able to import my notes bh running the script for each subdirectory, where each subdirectory has notes attributed to a separate Notebook Someone with more skills than me could probably easily modify your script to get a list of subdirectories and then execute your script for each subdirectory, making the process even easier than it was for me. Link to comment
PastorJosh 10 Posted December 4, 2019 Share Posted December 4, 2019 I am completely new to Apple scripts. I have used EN for random things like web clippings, scans and Pennuliate. However I have used MacJournal for my notes and all kinda of notebooks. I have probably over a thousand of notes dating over 10 years. The created date is important to me too. However all you have suggested is foreign to me. Any very basic help in understating it would be great. Link to comment
Level 5 PinkElephant 8,784 Posted December 5, 2019 Level 5 Share Posted December 5, 2019 There are some guys here in the thread that really know their stuff. I am sure your collection will find a new home in EN, with all the relevant facts. I do not know anything about scripting - maybe I should follow you on the trail to learn that craft. I think you will get a response - you can send anybody a direct message as well. Link to comment
KOO_NL 0 Posted February 29, 2020 Share Posted February 29, 2020 This script is excellent! Worked like a charm. Question: I would like to parse out the last part of the file name and set this as the import date. Any tips on adjusting the script? Home Depot- Order Confirmation - 2019-09-26.pdf Link to comment
PastorJosh 10 Posted August 27, 2020 Share Posted August 27, 2020 On 3/19/2017 at 6:50 AM, DTLow said: If you PM me the script you're running I'll check it out I am getting the same message.. I would PM but not sure how to do that on here. I also tried the script also given with more detail. I like the added modified not just created date, but would take any. I am coming over from Macjournal .. Thanks in advance. Link to comment
Level 5 PinkElephant 8,784 Posted August 27, 2020 Level 5 Share Posted August 27, 2020 PM: I you go to the top of the Forum page, there is to the right a little Bell, and an envelope beside it. When you click on the envelope, you enter the PM function, which is a mail service included in the forum. You enter the forum name of who you want to send the e-mail, type header and text and send it. Answers will collect in the PM view of your profile. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now