Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Find/Change in Applescript

New Here ,
Sep 13, 2012 Sep 13, 2012

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!

TOPICS
Scripting
2.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Sep 13, 2012 Sep 13, 2012

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

Translate
Enthusiast ,
Sep 13, 2012 Sep 13, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 13, 2012 Sep 13, 2012

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??!)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 13, 2012 Sep 13, 2012

Hi,

no. If you have RegEx SearchCriterias then have a look for the grepsearch.

some link: http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/InDesignCS5_Scr...

Hans-Gerd Claßen

'Hans H.', guess I know whome you mean ... (Uhh, is this english? 😉 )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 13, 2012 Sep 13, 2012

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...


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2012 Sep 14, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 14, 2012 Sep 14, 2012
LATEST

You know you want to switch over? Just expect your dictionary to be a whole lot thicker…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines