Tuesday, June 27, 2017

#1 2017-06-16 12:17:26 pm

Registered: 2015-03-12
Posts: 23

InDesign identify and replace text

Guys, I need you help with InDesign.

I am designing a catalogue with thousands of photos. Under every photo I should type the code of the product/photo. The photos have that exact syntax in their name "1010-1201 INKY BLUE304 1.jpg". Another example is "1101-0977 ROSEWOOD407 2.jpg" I am interesting for the 8 digits with the hyphen only, which they are always in the beginning of the filename. Under the photo I input a text field in InDesign CC where I should type these 8 digits with the hyphen (1101-0977). I don't know how to bind this text field with the photo and input the first 8 digits and the hyphen automatically.

So my thought is.... How this text field can recognize the first part of the filename (1101-3456) which is unique on every photo and type it in this field?

Any idea?

Browser: Safari 537.36
Operating System: Mac OS X (10.10)

Last edited by Viti (2017-06-16 12:24:03 pm)



#2 2017-06-19 03:19:52 am

Registered: 2012-12-02
Posts: 15

Re: InDesign identify and replace text


try this; this script walks thru every group on each page, so make shure only your illustration and textframe which belong together are grouped and nothing else.

tell application "Adobe InDesign CS6"
    set pageCounter to 1
    set groupCounter to 1
    repeat (count pages of active document) times
        tell document 1
            repeat (count groups of page pageCounter) times
                set theFileName to name of item link of graphic 1 of first rectangle of group groupCounter
                set theFileName to (characters 1 thru 9 of theFileName) as string
                set contents of first text frame of group groupCounter to theFileName
                tell first text frame of group groupCounter to tell paragraph 1
                    set applied font to "DIN    Medium"
                    set point size to 12
                    set fill color to color id 11
                    set justification to left align
                    set composer to "Adobe Composer alinea"
                end tell
                set groupCounter to (groupCounter + 1)
            end repeat
        end tell
        set pageCounter to (pageCounter + 1)
    end repeat
end tell

Kind regards, Eric

Last edited by EricLipton (2017-06-19 03:21:52 am)



Board footer

Powered by FluxBB

[ Generated in 0.034 seconds, 11 queries executed ]

RSS (new topics) RSS (active topics)