Jump to content

Import several hundred notes with their creation date - OSX


Recommended Posts

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*
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
  • Level 5*
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.scpt58cdff013e4bd_ScreenShot2017-03-18at8_44_25PM.png.4c0d6a1e4175ff51638bc3a3dcb571a3.png
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

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*
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
  • Level 5*
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
  • Level 5*
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

@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
  • 1 year later...
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
  • 1 year later...

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

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
  • 2 months later...

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
  • 5 months later...
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...