Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Evernote Mac -- Add Prefix or Suffix to Selected Note Titles
(*
===============================================================================
Add Prefix or Suffix to Selected Note Titles
===============================================================================
VER: 1.0 LAST UPDATE: 2017-04-17
AUTHOR: JMichaelTX
USE AT YOUR OWN RISK.
This script has had only VERY LIMITED TESTING.
This script is provided simply as an example, as a learning tool,
and is not intended for production use without further testing
and verification by the user of the script.
HOW TO USE:
0. It is strongly recommended that you backup the Notes you plan to change BEFORE running this script.
• Copy the Notes to another Notebook
OR
• Export the Notes to ENEX file.
1. Select the Notes in Evernote that you want to change.
• BEFORE running this script for a lot of Notes, you should first run it with ONLY ONE Note to make sure it works as you expect.
2. Run this script
3. Enter text to be used as Prefix or Suffix
• Be sure to include any separators you want, like SPACES
• The script will NOT add any other characters
4. Click on either the "Prefix" or "Suffix" button to indicate your choice
5. Carefully review the Confirmation window, and click "Confirm" if you are SURE you want to make the changes.
6. The script will then CHANGE ALL SELECTED Notes, applying the Prefix/Suffix as you specified.
7. A log of the changes is provided at the bottom of the Script Editor Event panel.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: Changes made by this script CANNOT be easily undone.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
• This script does NOT provide an UNDO feature
• The only means to undo the changes are:
• Manually edit every Note
• Recover the prior version of each Note from Note History
• Write another script
• Again, BACKUP your Notes PRIOR to running this script.
(see above)
INSTALLATION: See http://tinyurl.com/install-as
REF: The following were used in some way in the writing of this script.
1. SCRIPT WRITTEN IN RESPONSE TO:
batch editing titles to add text at beginning or end of title - Evernote User Forum
https://discussion.evernote.com/topic/105614-batch-editing-titles-to-add-text-at-beginning-or-end-of-title/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NO WARRANTY:
The software is provided "as is" and the author disclaims all warranties with regard to this software including all implied warranties of merchantability and/or fitness for a particular purpose.
NO INDEMNITY:
In no event shall the author or Copyright holder be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software.
===============================================================================
*)
(*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EXAMPLE RESULTS
(*Title CHANGED To: Test 1 for Title Change [Suffix Test 2]*)
(*Title CHANGED To: Test 2 for Title Change [Suffix Test 2]*)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*)
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Evernote"
activate
set noteList to selection
set numNotes to count of noteList
---------------------------------------
-- GET PREFIX/SUFFIX INFO FROM USER
--------------------------------------
set msgStr to ¬
"You have selected >>>" & numNotes & "<<< Note(s) to Modify" & return ¬
& return & "Enter the text to Prefix or Suffix your Titles" & return & "(Be sure include any separators you want including SPACES)"
set titleStr to "Modify Note Title of ALL Selected Notes"
display dialog msgStr ¬
with title titleStr ¬
buttons {"Cancel", "Prefix", "Suffix"} ¬
default button ¬
"Suffix" cancel button ¬
"Cancel" with icon caution ¬
default answer " (My Suffix)"
set ansRec to result
set modType to button returned of ansRec
set titleAddStr to text returned of ansRec
--- ABORT SCRIPT IF NO TEXT WAS PROVIDED ---
if (titleAddStr = "") then
set errMsg to "ERROR: No text was entered for Prefix/Suffix."
display notification ¬
errMsg with title titleStr ¬
subtitle ¬
"Script Canceled." sound name "Glass"
error errMsg
end if
---------------------------------------------
-- CONFIRM DATA WITH USER --
---------------------------------------------
set msgStr to ¬
"CONFIRM these are the changes you want to make:" & return & return & "Number of Notes to Change: " & numNotes ¬
& return & "Change Type: " & modType ¬
& return & return & ¬
"Text to Add: (brackets not included)" & return & ">>>" & titleAddStr & "<<<"
display dialog msgStr ¬
with title titleStr ¬
buttons {"Cancel", "Confirm"} ¬
default button ¬
"Confirm" cancel button ¬
"Cancel" with icon stop
-------------------------------------------------------
-- LOOP THROUGH EACH SELECTED NOTE, MAKING CHANGES --
-------------------------------------------------------
repeat with oNote in noteList
set noteTitleStr to title of oNote
--- HANDLE PREFIX OR SUFFIX ---
if (modType = "Suffix") then
set newTitle to noteTitleStr & titleAddStr
else
set newTitle to titleAddStr & noteTitleStr
end if
--- APPLY CHANGE TO Evernote NOTE ---
set title of oNote to newTitle
log "Title CHANGED To: " & newTitle
end repeat
end tell
--~~~~~~~~~~~~~~~~~~~~~ END OF MAIN SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@JMichaelTX

This comment has been minimized.

Copy link
Owner Author

commented Apr 17, 2017

Example Results

image

image

image

Script Editor Log Panel

(*Title CHANGED To: Test 1 for Title Change [Suffix Test 2]*)
(*Title CHANGED To: Test 2 for Title Change [Suffix Test 2]*)

@JMichaelTX

This comment has been minimized.

Copy link
Owner Author

commented Apr 28, 2017

2017-04-27 7:18 PM CT
Test to confirm notifications by Guscus.

@mattstauffer

This comment has been minimized.

Copy link

commented Apr 28, 2017

Testing comment notification

@JMichaelTX

This comment has been minimized.

Copy link
Owner Author

commented Apr 28, 2017

Testing comment notification

Got the email notification. Thanks Matt!!

If you need email notifications for your Github Gists,
see Gist comment notification for free: https://giscus.co

To post questions/issues, see:
https://github.com/tightenco/giscus/issues

@JMichaelTX

This comment has been minimized.

Copy link
Owner Author

commented Mar 17, 2019

Another TEST for email notification of Gist Comments by Always Be Closing Jr
2019-03-17 15:15 GMT-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.