InDesign Search & Replace

Hi All,

I want to search content “1” of font “Mathematical Pi” and replace in content “plus” of font “Times”.

Thanks

Hi,

afaik InDesign does only support searching for text - not for styles/font etc. - so you probably you have to do sth like this:

tell application “InDesign CS”
activate
set myDocument to active document
set searchresults to search myDocument for “1”
repeat with thisResult in searchresults
if (applied font of thisResult is font “Mathematical Pi\t1”) then
set applied font of thisResult to font “Times”
set text of thisResult to “+”
end if
end repeat
end tell

Hi Dominik,

I have tried the code posted by you, but it is not working at all. I compile well and also run well, but it doesnot effect any changes in the file.


tell application "Adobe InDesign CS2"
    activate
    set myDocument to active document
    set searchresults to search myDocument for "1"
    repeat with thisResult in searchresults
        if (applied font of thisResult is font "Mathematical Pi 1") then
            set applied font of thisResult to font "Times"
            set text of thisResult to "+"
        end if
    end repeat
end tell

Thanks
Pooja

Pooja,

I tried the script here before posting and it worked for me. Unfortunately I don’t own Indesign CS 2 - so I tried with CS. Maybe that’s the reason?
Or maybe the problem is the spelling of the Mathematical Pi 1-Font’s name? The Version of this font I have here (Adobe Font Folio) has a tab character between ‘Pi’ and ‘1’ - Pi1 does not work. That’s why I wrote: ‘"Mathematical Pi\t1’ in my script above.

D.

Hi Diminik,

Perhaps I have removed \t so it doesn’t work for me.

I will try it tommorow and get back to you.

Bye the way thanks a ton.

Pooja

Hi

I want to search and replace mdash and doing like this, I think I an doing something wrong so it is not working at all

	search for "^-" replacing with "[md]" with find attributes {format:false} with change attributes {format:false}

Please suggest me.