Scooter 11 Posted August 11, 2017 Share Posted August 11, 2017 I have a lot of notes that come into Evernote from various automatic sources (drops into a specific folder, IFTTT, etc.) I'd like the bone of an Applescript that would help me organize this mess, all of which piles up in my inbox. Most of these automatic things are arranged to put specific tags on notes as they are created. I would like to create a Applescript that will search all my notes, find ones tagged with a particular tag, the rename that note with a title and a modified version of the note creation date. Finally I'd like the original tag deleted and new ones applied and have it moved into a specific folder. I know how to do a lot of that, but some things (like parsing out the creation date and reformatting it) it beyond me. Can anybody help with this? Link to comment
Level 5* JMichaelTX 4,115 Posted August 11, 2017 Level 5* Share Posted August 11, 2017 22 minutes ago, Scooter said: I have a lot of notes that come into Evernote from various automatic sources (drops into a specific folder, IFTTT, etc.) I'd like the bone of an Applescript that would help me organize this mess, all of which piles up in my inbox. . . . I know how to do a lot of that, but some things (like parsing out the creation date and reformatting it) it beyond me. Can anybody help with this? I can probably help. Please post the script (in a zip file if you prefer) you have so far, and add comments in it where you need help. May I suggest this form of a comment: ### HELP: Describe the issue, error, problem, or action you want. # If you need multiple lines, start each with the # symbol. In case you don't know, the # symbol is an alternate to -- as a comment indicator. Also, if you have not already done so, I highly recommend installing the Satimage.osax (Free D/L & info at http://tinyurl.com/Satimage-Osax-DL ) scripting addition. It has excellent RegEx find/change tools, as well as date formatting and string and list handling. It has been available for years now, and is highly reliable and safe. Good luck. Everything you asked for seems very doable to me. If I don't respond quickly to your follow-up post, feel free to PM me. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ EDIT: 2017-08-11 2:34 AM CT Also, I will need some good, real-world sample data. It would be great if you could export to ENEX a good sample of Notes that you want to process, and upload them in a zip file (in a PM to me if you prefer). Of course I'll need a table of the old to new tags. Link to comment
Level 5* DTLow 5,735 Posted August 11, 2017 Level 5* Share Posted August 11, 2017 18 hours ago, Scooter said: I would like to create a Applescript that will search all my notes, find ones tagged with a particular tag, the rename that note with a title and a modified version of the note creation date. Finally I'd like the original tag deleted and new ones applied and have it moved into a specific folder. I know how to do a lot of that, but some things (like parsing out the creation date and reformatting it) it beyond me. Can anybody help with this? My Process-Inbox script is documented at https://www.evernote.com/l/AArgmVF4KRhEObasbIU6rAVTET15Wre7odI In my script, I parse and reformat dates with code set {year:yyyy, month:mmm, day:d, weekday:dddd} to (current date) set dd to ("0" & d as string) set dd to (text -2 thru -1 of dd) as string set m to mmm as integer set mm to ("0" & m as string) set mm to (text -2 thru -1 of mm) as string set yyyymmdd to (yyyy as string) & "/" & mm & "/" & dd The date parsing was easy but further work was required to obtain a 2 digit month/day My script operates on the selected note, but a search string can be applied using code such as tell application "Evernote" to set theNotes to find notes ("tag:xxxxx") I've deleted tags using the code unassign tag "!Type-Templates" from newNote Link to comment
Level 5* JMichaelTX 4,115 Posted August 11, 2017 Level 5* Share Posted August 11, 2017 Here's an easy way to get the ISO date format from an AppleScript date: set dateISOStr to text 1 thru 10 of ((current date) as «class isot» as string) -->2017-08-11 Link to comment
Scooter 11 Posted August 13, 2017 Author Share Posted August 13, 2017 Great. Thanks for the help. Those work great. Is there a way to pull out the 'created date' from a note, rather than the current date? Link to comment
Scooter 11 Posted August 13, 2017 Author Share Posted August 13, 2017 I don't actually have a complete script. But I've designed several others to import files, assign tags, etc. What I really can't figure out is how to pull the created date out of the notes, and to search for a given tag. Link to comment
Level 5* JMichaelTX 4,115 Posted August 13, 2017 Level 5* Share Posted August 13, 2017 Just now, Scooter said: Is there a way to pull out the 'created date' from a note, rather than the current date? Sure. set creationDate to creation date of oNote Link to comment
Level 5* JMichaelTX 4,115 Posted August 13, 2017 Level 5* Share Posted August 13, 2017 9 minutes ago, Scooter said: What I really can't figure out is how to pull the created date out of the notes, and to search for a given tag. Select one Note in EN Mac, and run this from the Script Editor: tell application "Evernote" set noteList to selection -- Notes selected by User in UI -- OR -- --set noteList to (find notes "notebook:.Inbox") -- Same as Search Box in UI set numNotes to count of noteList log "Num of Notes: " & numNotes set noteIndex to 0 repeat with oNote in noteList set noteIndex to noteIndex + 1 tell oNote set noteTitleStr to title set creationDate to creation date set modificationDate to modification date set NBName to name of notebook of oNote set tagList to tags -- get list of tag objects end tell ### Instead of the repeat loop, seems like some type of "every" statement should work, like this: ### # set tagNameList to (name of every tag in tagList as list) # log tagNameList (* --- NOTE PROPERTIES --- altitude, creation date, ENML content, HTML content, latitude, longitude, modification date, note link, notebook, reminder done time, reminder order, reminder time, source URL, subject date, tags, title -- AVAILABLE, BUT NOT DOCUMENTED -- active, author, class, content class, guid, id, place name, source, source application *) log "[" & noteIndex & "]: " & noteTitleStr log " • Notebook: " & NBName log " • Created : " & creationDate log " • Last Mod: " & modificationDate end repeat end tell -- Evernote Link to comment
Level 5* DTLow 5,735 Posted August 13, 2017 Level 5* Share Posted August 13, 2017 16 minutes ago, Scooter said: What I really can't figure out is how to pull the created date out of the notes, and to search for a given tag. tell application "Evernote" to set theDate to creation date of theNote tell application "Evernote" to set theNotes to find notes ("tag:xxxxx") Link to comment
Level 5* JMichaelTX 4,115 Posted August 13, 2017 Level 5* Share Posted August 13, 2017 15 minutes ago, Scooter said: search for a given tag. set noteList to (find notes "tag:EN.Mac") set numNotes to count of noteList log "Num of Notes: " & numNotes set noteIndex to 1 set oNote to item noteIndex in noteList Replace the "set noteList to selection " and the repeat loop with the above to search for a tag. The search criteria is identical that that you type into the EN Mac Search box. Link to comment
Scooter 11 Posted August 13, 2017 Author Share Posted August 13, 2017 Fantastic. Let me work on this for a day or two, but that looks simple. Thanks! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.