Skip to content

Instantly share code, notes, and snippets.

@JMichaelTX
Last active January 22, 2016 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JMichaelTX/43f89c737b83b4377598 to your computer and use it in GitHub Desktop.
Save JMichaelTX/43f89c737b83b4377598 to your computer and use it in GitHub Desktop.
Evernote AppleScript to Set author property of Selected Notes (AS)
(*
===============================================================================
Set Author of Selected Notes
===============================================================================
VER: 1.0 LAST UPDATE: 2016-01-21
PURPOSE:
• Set the Author field in all selected Notes
AUTHOR: JMichaelTX
Find any bugs/issues or have suggestions for improvement?
Contact me via PM or at blog.jmichaeltx.com/contact/
REQUIRED:
1. Mac OS X Yosemite 10.10.5+
2. Mac Applications
• Evernote
3. INTERNAL FUNCTIONS:
• continueScript(pMsgStr)
• getUserAns(pMsgStr)
COMMENTS
• The "author" property is NOT shown as a property of the Notes object
in the Evernote Scripting Dictionary.
• However, testing revealed that it is available.
===============================================================================
*)
---------------------------
tell application "Evernote"
-------------------------
set notesList to selection
set iNumNotes to count of notesList
log ("Number of Notes to Process: " & iNumNotes)
if (not my continueScript("Number of Notes in Selection: " & iNumNotes)) then return
set newAuthorStr to my getUserAns("Enter Author for Selected Notes")
log ("*** New Author: " & newAuthorStr & " ***")
log ("START: " & ((current date) as text))
set iNote to 0
-------------------------------
repeat with oNote in notesList
-----------------------------
set iNote to iNote + 1
set titleStr to title of oNote
log ("[" & iNote & "]: title: " & titleStr)
set author of oNote to newAuthorStr
end repeat -- oNote
end tell -- Evernote
---------------------------
log ("END: " & ((current date) as text))
--~~~~~~~~~~~~~~~~~~~~~~~~~~ END OF MAIN SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~
###—————————————————————————————————————————————————————————————————————
# continueScript() Confirm Running of Script
#
# Ver 1.0 2016-01-21
###—————————————————————————————————————————————————————————————————————
on continueScript(pMsgStr)
--––––––––––––––––––––––––––––––
beep
set ansRec to (display alert "Continue or Cancel?" message pMsgStr as critical ¬
buttons {"Cancel", "Continue"}) -- last button is default
set strAns to button returned of ansRec
if (strAns = "Continue") then
set continueBol to true
else
set continueBol to false
end if
return continueBol
end continueScript
--——————————————————————————————————————————————————————————————————————
###—————————————————————————————————————————————————————————————————————
# getUserAns() Get Users Input
#
# Ver 1.0 2016-01-21
###—————————————————————————————————————————————————————————————————————
on getUserAns(pMsgStr)
--––––––––––––––––––––––––––––––
beep
set ansRec to (display dialog pMsgStr ¬
with title (name of me) ¬
with icon caution ¬
default answer "")
set ansStr to text returned of ansRec
return ansStr
end getUserAns
--——————————————————————————————————————————————————————————————————————
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment