SCRIPT- find / replace word in TITLE

Hi all. Tonight I got around to making a script for FIND / REPLACE WORD IN TITLE of auction template.

It works, but I notice sometimes you have to run it a few times if you have alot of template titles to change.

Please say thanks if you download the script. Cheers.

SCRIPT - FIND / REPLACE WORD IN TITLE v.1


set theReply1 to (display dialog “Enter Title text to be replaced (All Selected Templates)” default answer “text” buttons {“Cancel”, “Continue”} default button “Continue”)
set origtext to text returned of theReply1

set theReply2 to (display dialog “Enter new replacement text” default answer “text” buttons {“Cancel”, “Continue”} default button “Continue”)
set replacetext to text returned of theReply2

to searchReplace(thisText, searchTerm, replacement)
set AppleScript’s text item delimiters to searchTerm
set thisText to thisText’s text items
set AppleScript’s text item delimiters to replacement
set thisText to “” & thisText
set AppleScript’s text item delimiters to {""}
return thisText
end searchReplace

tell application "GarageSale"
repeat with aTemplate in every selected template
set origline to get the title of aTemplate
set title of aTemplate to my searchReplace(origline, origtext, replacetext)
end repeat
end tell

1 Like