Hello
I have a simple script that works on an open iwork file
allowing you to insert your own texts in the place of replacement text
(placeholder text). The action can be performed only once - after swapping
I already have plain text - so I can not go wrong or do it again …
I need to modify the script so that after inserting my own texts instead of replacement text, the changed texts are still marked as placeholder text so that I can re-apply the script in the same document …
basically, I do not know much about the Apple script, so any help will be appreciated.
thank you in advance
Marcin
tell application "Pages"
activate
if not (exists document 1) then error number -128
tell document 1
-- GET ALL TAGS
set theseTags to the tag of every placeholder text
-- FILTER FOR UNIQUE TAGS
set uniqueTags to {}
repeat with i from 1 to the count of theseTags
set thisTag to item i of theseTags
if thisTag is not in uniqueTags then
set the end of uniqueTags to thisTag
end if
end repeat
-- PROMPT USER FOR REPLACEMENT TEXT
repeat with i from 1 to the count of uniqueTags
set thisTag to item i of uniqueTags
display dialog "Enter the replacement text for this tag:" & ¬
return & return & thisTag default answer "" buttons ¬
{"Cancel", "Skip", "OK"} default button 3
copy the result to {button returned:buttonPressed, text returned:replacementString}
if buttonPressed is "OK" then
set (every placeholder text whose tag is thisTag) to replacementString
end if
end repeat
end tell
end tell