George Dyke 1 Posted May 23, 2016 Share Posted May 23, 2016 Hi! I'm not new to Evernote, but new to the forum, and new to AppleScripts. I am seeing AppleScripts could be quite powerful in helping me automate a couple of my more routine work flows. I have managed to get an AppleScript running to assign and unassign tags to a note, and to move it to a new notebook. However, what I'd like to do now is to set the reminder on a given note to 'Tomorrow' as a part of the AppleScript. Here's my current AppleScript - Quote set myRemind to ((current date) + 1 * days) as date tell application "Evernote" activate set theNote to selection set reminder order of theNote to myRemind end tell And here's the output I'm getting when I run it - Quote error "Can’t set «class EVro» of {«class EVnn» id \"x-coredata://504251FE-F69E-4301-BB76-6835F97703FC/ENNote/p22449\" of «class EVnb» \"APNS\" of application \"Evernote\"} to date \"Tuesday, 24 May 2016 at 3:43:15 PM\"." number -10006 from «class EVro» of {«class EVnn» id "x-coredata://504251FE-F69E-4301-BB76-6835F97703FC/ENNote/p22449" of «class EVnb» "APNS"} I have read several other threads where people describe a similar problem. However, having gleaned all I can from those threads (and a number of other spots on the internet), I can't quite crack this one. To the point where I'm not sure if this is even possible...? I note that the formatting of the date in the error message is a bit odd. Quote Tuesday, 24 May 2016 at 3:43:15 PM And perhaps this is causing an issue. However, I can't see any obvious way to get AppleScript to output the date in any other formats. (Besides some hideous hacks that manually assemble a date string - but seems like it should be easier.) I have played around with as date, as string, as text, but none of them seem to help. I have tried applying the date directly as (current date), or calculating the myRemind variable as per the above and the message basically remains the same. I also played around with setting 'reminder time' vs. 'reminder order', but also no luck. And tried changing the 'modification date' field to see if that made a difference. And also trying 'date string' to get only the day part of it, and not the time. But none of those paths seemed to win. I feel like I'm close above, but missing some small point. And would welcome any suggestions, links (with working part or whole solutions), and/or some better documentation of the expected date format on the one hand, and how to get that from (current date) on the other. Some configuration infomration - OS X 10.11.5, and Evernote 6.6.1. Thanks for any suggestions you can offer. George Link to comment
Level 5* DTLow 5,736 Posted May 23, 2016 Level 5* Share Posted May 23, 2016 On May 23, 2016 at 11:00 PM, George ***** said: I'm not new to Evernote, but new to the forum, and new to AppleScripts. I am seeing AppleScripts could be quite powerful in helping me automate a couple of my more routine work flows. I have managed to get an AppleScript running to assign and unassign tags to a note, and to move it to a new notebook. However, what I'd like to do now is to set the reminder on a given note to 'Tomorrow' as a part of the AppleScript. Here's my current AppleScript - set myRemind to ((current date) + 1 * days) as datetell application "Evernote" activate set theNote to selection set reminder order of theNote to myRemindend tell Applescript is a great tool and all Mac users should try it out You're trying to update reminder order This should be reminder time Don't worry about the date format. I have been successful with set creation date of newNote to current date If you look at the Script Editor dictionary for Evernote, you will see nnote n : A note. elements contains attachments; contained by collection windows, note windows, notebooks. properties title (text) : The note's title. creation date (date) : The note's creation date. modification date (date) : The note's last modification date. subject date (date or missing value) : The date associated with the note's content. source URL (text or missing value) : The note's source URL. latitude (real or missing value) longitude (real or missing value) altitude (real or missing value) ENML content (text, r/o) : The note's content in ENML representation. HTML content (text) : The note's content in HTML representation. tags (list of tag) : The tags assigned to this note. notebook (notebook, r/o) : The notebook containing this note. note link (text, r/o) : A URL specifying this note. NOTE: if this note is in a synchronized notebook but has not yet been synchronized itself, the result will be nil. reminder time (date or missing value) : The reminder time for the note. reminder done time (date or missing value) : The time the reminder for the note was marked completed. reminder order (date or missing value) : The reminder order time for the note. When not empty, this is what indicates the note has a reminder. To add a reminder to a note, typically set its reminder order to the current date. Link to comment
Level 5* DTLow 5,736 Posted May 23, 2016 Level 5* Share Posted May 23, 2016 9 hours ago, George ***** said: However, what I'd like to do now is to set the reminder on a given note to 'Tomorrow' as a part of the AppleScript. I replied in another post about your Applescript issue It was interesting to see your post about reminders. Your process could also be used to reset reminder date for recurring reminders, or to add the reminder as a calendar event. Reminders can be a useful tool. My saved search for Current Tasks is reminderTime:* -tag:!Archive -reminderTime:day+1 -reminderDoneTime:* I sync my reminders to the calendar app using Cronofy Calendar Collector Link to comment
George Dyke 1 Posted May 23, 2016 Author Share Posted May 23, 2016 Thanks DTLow, I have modified the script as follows, referencing reminder time. Quote tell application "Evernote" activate set theNote to selection set reminder time of theNote to (current date) end tell However, it's still throwing an error. Quote error "Can’t set «class EVrt» of {«class EVnn» id \"x-coredata://504251FE-F69E-4301-BB76-6835F97703FC/ENNote/p22459\" of «class EVnb» \"APS\" of application \"Evernote\"} to date \"Tuesday, 24 May 2016 at 9:17:54 AM\"." number -10006 from «class EVrt» of {«class EVnn» id "x-coredata://504251FE-F69E-4301-BB76-6835F97703FC/ENNote/p22459" of «class EVnb» "APS"} Perhaps the issue with my script is how I'm selecting the note? As I mentioned, I am able to assign and unassign tags to notes set in this way. But perhaps there's some issue when it comes to the date...? If anyone has done this and can post a complete script, would be great to give it a try. George Link to comment
Level 5* DTLow 5,736 Posted May 24, 2016 Level 5* Share Posted May 24, 2016 17 hours ago, George ***** said: Perhaps the issue with my script is how I'm selecting the note? As I mentioned, I am able to assign and unassign tags to notes set in this way. But perhaps there's some issue when it comes to the date...? tell application "Evernote"activate set theNote to selectionset reminder time of theNote to (current date)end tell Sorry - I should have addressed this in my first post You might try something like set theSelection to get selection set oNote to item 1 of theSelection The second line is important because your selection could be a group of notes. Another approach would be to use a repeat loop for each note Link to comment
George Dyke 1 Posted May 24, 2016 Author Share Posted May 24, 2016 DTLow - beaut! Here's the (a?) winning move to make the reminder tomorrow. Quote set myRemind to ((current date) + 1 * days) as date tell application "Evernote" activate set theSelection to get selection set theNote to item 1 of theSelection set reminder time of theNote to myRemind end tell And as a special bonus, this one will mark the reminder as completed as of (current date). Quote set myRemind to ((current date) + 1 * days) as date tell application "Evernote" activate set theSelection to get selection set theNote to item 1 of theSelection set reminder done time of theNote to (current date) end tell Thanks for sounding this out with me. Hopefully it will help someone else. George Link to comment
George Dyke 1 Posted May 24, 2016 Author Share Posted May 24, 2016 And if you want the reminder to be at 9 AM the next day, you can set myRemind like this. Quote set myRemind to ((current date) + 1 * days) as date set the time of myRemind to 32400 Link to comment
Level 5* DTLow 5,736 Posted June 25, 2016 Level 5* Share Posted June 25, 2016 On May 23, 2016 at 9:15 PM, George ***** said: And as a special bonus, this one will mark the reminder as completed as of (current date). I'm trying to do the opposite; reset the reminder to not done I've not been able to clear the reminder done time. Setting to null, "", {} doesn't work. Edited: setting the field to "missing value" works Link to comment
Jasp 5 Posted November 13, 2018 Share Posted November 13, 2018 I'm struggling to get George's applescript to work with a shortcut in Evernote - can anyone tell me what I'm doing wrong please? 1. The applescript works, when it's run in the Applescript Editor. 2. I've put the applescript in an Automator service with 'Service receives No Imput in All Applications.' 3. The Automator service has a shortcut set. 4. Evernote, Automator and Finder are green lit in Security & Privacy > Accessibility 5. If I look at the available Services in Evernote, I see the Service in the dropdown list but not the shortcut. The service runs if I select it from the list but the shortcut fails. (see pictures). Obviously using the shortcut when in Evernote is the best place. 6. If I look at the available Services in Finder, I see the Service in the dropdown list and the shortcut. The applescript runs both by selection in the list and by the shortcut. So it's as though Evernote is happy about running the script but dislikes the shortcut. Link to comment
Level 5* DTLow 5,736 Posted November 13, 2018 Level 5* Share Posted November 13, 2018 35 minutes ago, Jasp said: applescript to work with a shortcut No ideas on the Services issue; I use Fastscripts to simplify the shortcut process Link to comment
Jasp 5 Posted November 13, 2018 Share Posted November 13, 2018 Thanks for the tip, DTLow - I'm set up on FastScripts now Link to comment
George Dyke 1 Posted November 14, 2018 Author Share Posted November 14, 2018 Great! Just confirming that I also use FastScripts to run this. Link to comment
Jasp 5 Posted November 14, 2018 Share Posted November 14, 2018 Good to know George, thanks - Running Applescript with Automator Services usually works fine for me but - irrespective of the missing Evernote shortcut - it's quite fiddly. FastScripts seems much more efficient. I'm convinced! Link to comment
seomotard02 0 Posted November 21, 2018 Share Posted November 21, 2018 I really enjoyed. สมัคร ufabet : po Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.