Jump to content

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

 

 

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

 

 

Link to comment
  • 3 weeks later...

Sorry for the delayed response.  Got very busy.  So this change did the trick and it worked like a charm.

BUT..  It sounds like you've been using EN for a long time and you already use my current model with date first?  So far, it's not terrible for me - I just see a date followed by another date and then the file name.  Have you found your naming scheme to be usable in the long run?  Thanks for you help!

Link to comment
  • Level 5*
5 hours ago, PaperlessBrian said:

Have you found your naming scheme to be usable in the long run?

Yes, I prefix my titles with the subject date; as in    2019/09/29 Home !HomeContents-Bedroom  [Lamp]

This works for me.  I needed to store the subject date, and this seems the best location

My title standard is subject-date type keyword keyword...[description]

For some lists I parse the title and just use the description    
My task list just shows  
Project/Task where Project is a tag, and Task is description

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...