Jump to content
Sign in to follow this  
PaperlessBrian

Get note title with AppleScript

Recommended Posts

Hello everyone, I've made the leap to Evernote and after importing over 1000 notes, I've realized that the filenames I used with my file system (YYYY-MM-DD filename) is not very readable as a note title.  Essentially you get the look of a Creation Date followed by another date and finally the name of the note.  In many cases I'm sending notes over email without any date in the name and so I'd like to create an AppleScript I can use from the Services menu to move the date to the end of the note title.  The only issue is that I don't know how to get the note title so I can then manipulate it in AppleScript.  Any advice?  Here's what I have so far...

I suspect that when I "set noteTitle to title of n" that I'm not actually getting a string but perhaps something in HTML that I need to first convert to a string...?

Quote

 

on run {}

tell application "Evernote"

set the_notes to selection

set the_count to 1

repeat with n in the_notes

set noteTitle to title of n

set noteDate to characters 1 thru 10 of noteTitle

set noteName to characters 11 thru -1 of noteTitle

set title of n to noteName & " " & noteDate

set the_count to the_count + 1

end repeat

end tell

end run

 

 

Share this post


Link to post
On 10/9/2019 at 6:30 PM, PaperlessBrian said:

I suspect that when I "set noteTitle to title of n" that I'm not actually getting a string but perhaps something in HTML that I need to first convert to a string...?

Seems fine to me1240694006_ScreenShot2019-10-09at19_15_16.png.b922e621acc5320a6370303e16d96ad9.png
Insert   display dialog noteTitle   to see what's being retrieved
You can also use View > Show Log   to provide more feedback

>>set noteName to characters 11 thru -1 of noteTitle

Returns an array of characters {"a", "b", "c" .....}

You should use set noteName to text 11 thru -1 of noteTitle

>>set title of n to noteName & " " & noteDate

I would insert a condition test (if) to ensure noteDate is actually a date

>>(YYYY-MM-DD filename) is not very readable as a note title

My naming standard is    yyyy/mm/dd type keyword ... keyword [description]

yyyy/mm/dd is the Subject Date (default Created Date)

Examples: 2019/10/06 Journal  [Sunday]
                    2019/09/29 Home !HomeContents-Bedroom  [Lamp]
                    2019/10/09 Receipt ?Vndr-Walmart !Budget-FoodGrocery  [Groceries] $-13.13

 

 

Share this post


Link to post

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
Sign in to follow this  

×
×
  • Create New...