Hi all-
I’m trying to use AS to find text that has a particular paragraph style applied to it, and apply a different paragraph style to that text. Same for character styles. I need to do this several times in the same document. We’re importing an InCopy doc that has its own styles applied, and I need a quick way to map the new (and differently named, of course) styles to the imported text.
Here’s an example of what I’m doing. I have to repeat this line for every change, and sometimes the script just stops:
search with find attributes {applied paragraph style:“¢BMStratTxt”} with change attributes {applied paragraph style:“SB_Strat_Txt”}
Additionally, once the script is run, I have to quit InDesign and relaunch before it will work again.
There’s gotta be a more elegant way to do this. I’ll post the entire script below.
I’m running Indesign CS 3.0.1 (CS2 compatibility patch has not been applied)
Mac OS X 10.3.8 (can’t update, I.T. won’t let me)
AppleScript 1.9.3
Any suggestions would undoubtedly make the universe a slightly better place.
----script follows----
tell application “InDesign CS”
activate
tell the active document
search with find attributes {applied paragraph style:"¢BMStratTxt"} with change attributes {applied paragraph style:"SB_Strat_Txt"}
search with find attributes {applied paragraph style:"¢BMVocabWords"} with change attributes {applied paragraph style:"SB_Vocab_List"}
search with find attributes {applied paragraph style:"¢BMVocStrat"} with change attributes {applied paragraph style:"SB_VocStra_Head"}
search with find attributes {applied paragraph style:"¢WowTxt"} with change attributes {applied paragraph style:"Txt_Lsn_Intro"}
search with find attributes {applied paragraph style:"¢LesHeadA"} with change attributes {applied paragraph style:"Head_A"}
search with find attributes {applied paragraph style:"¢FocusQuest"} with change attributes {applied paragraph style:"SB_FocusQues"}
search with find attributes {applied paragraph style:"¢HeadB"} with change attributes {applied paragraph style:"Head_B"}
search with find attributes {applied paragraph style:"¢RevQuest"} with change attributes {applied paragraph style:"Txt_Review"}
search with find attributes {applied paragraph style:"¢WYLTxt"} with change attributes {applied paragraph style:"WYLBoxTxt"}
search with find attributes {applied paragraph style:"¢LRNumList"} with change attributes {applied paragraph style:"LRBoxTxtList"}
search with find attributes {applied paragraph style:"¢Txt"} with change attributes {applied paragraph style:"Txt"}
search with find attributes {applied character style:"¢Highlight"} with change attributes {applied character style:"Highlight"}
search with find attributes {applied character style:"¢ReviewSkill"} with change attributes {applied character style:"Skill_Label"}
search with find attributes {applied character style:"¢Bold"} with change attributes {applied character style:"Bold"}
search with find attributes {applied character style:"¢LRBlu"} with change attributes {applied character style:"LRBoxLeadInBlu"}
search with find attributes {applied character style:"¢Red"} with change attributes {applied character style:"LRBoxLeadInRed"}
set right indent of paragraph style "¢Label" to 0
end tell
end tell
end
—end script----
Thanks all!
Eric Murray