Copy link to clipboard
Copied
I've been doing this in Quark for years, but can't think myself into ID mode! Can anyone give me the basic code necessary to search ALL the text of a document and replace, say, "Britain" with "America"?
This doesn't work! but at least proves I'm trying...
tell application "Adobe InDesign CS5"
tell document 1
repeat with i from 1 to count of stories
tell story i
set (every text where it is "Britain") to "America"
end tell
end repeat
end tell
end tell
Thanks for any help!
Hi,
I'm actually on PC but try sth. like this:
tell application "Adobe InDesign CS5.5"
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to "Dolores"
set change to of change text preferences to "Rihanna"
set theDoc to document 1
change text theDoc
set find text preferences to nothing
set change text preferences to nothing
end tell
Copy link to clipboard
Copied
Hi,
I'm actually on PC but try sth. like this:
tell application "Adobe InDesign CS5.5"
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to "Dolores"
set change to of change text preferences to "Rihanna"
set theDoc to document 1
change text theDoc
set find text preferences to nothing
set change text preferences to nothing
end tell
Copy link to clipboard
Copied
Oh my! Didn't know 'change text' existed. That works perfectly. Now I need to narrow it down to text matching certain conditions, but that's obviously where 'find text preferences' and 'change text preferences' come into it.
I can play on my own now.
(You aren't Hans H who used to be so helpful on the Quark forum are you??!)
Copy link to clipboard
Copied
Hi,
no. If you have RegEx SearchCriterias then have a look for the grepsearch.
Hans-Gerd Claßen
'Hans H.', guess I know whome you mean ... (Uhh, is this english? 😉 )
Copy link to clipboard
Copied
I will read it up. I thought I could use
set left indent of find text preferences to 9.921
set first line indent of find text preferences to -9.921
set left indent of change text preferences to 0
set first line indent of change text preferences to 0
(it doesn't help that the indent I need to remove is 3.5mm, which really upsets InDesign!)
Anyway, I'll try the grepsearch, which I have done before in a different context so should get back into it soon.
Thanks for your help! Many Hans make light work...
Copy link to clipboard
Copied
A life changing thread!
Funny how I just assumed that because in Quark I had to go round the houses to search and replace via Applescript, that it would be the same in ID. Just didn't look for the command because it never occurred to me that it would exist.
This has made the job in hand wonderfully quick to solve. One more nail in the coffin of formerly-much-beloved Quark.
Copy link to clipboard
Copied
You know you want to switch over? Just expect your dictionary to be a whole lot thicker… ![]()
Find more inspiration, events, and resources on the new Adobe Community
Explore Now