André Heijstek 0 Posted January 30, 2019 Share Posted January 30, 2019 I want to rename some of my existing tags. Those with a <space> in the name should change. E.g. from "applescript tag" to "applescript_tag". I wrote this script tell application "Evernote" set tagNameList to name of every tag repeat with i from 1 to number of items in tagNameList set this_tag to item i of tagNameList set trimmedTag to my replace_chars(this_tag, " ", "_") log this_tag log trimmedTag if (this_tag is not equal to trimmedTag) then set name of this_tag to trimmedTag end repeat end tell on replace_chars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end replace_chars But it gives errors: error "Can’t set name of \"applescript tag\" to \"applescript_tag\"." number -10006 from name of "test pyramid" Any idea what goes wrong? Link to comment
Level 5* DTLow 5,737 Posted January 30, 2019 Level 5* Share Posted January 30, 2019 set name of this_tag is not valid - this_tag is not a tag object; it's a simple text string ("applescript tag") Try set name of (tag this_tag) Link to comment
André Heijstek 0 Posted February 1, 2019 Author Share Posted February 1, 2019 Thanks a lot! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.