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

run in all open docs

Community Beginner ,
Sep 24, 2013 Sep 24, 2013

Copy link to clipboard

Copied

I'm trying to run this script  in all open  ID docs but it's only changing only 1 document instead of all . I know is something simple but I can't figure it out. Please advise where am I making the mistake.

tell application "Adobe InDesign CS4"

activate

 

          repeat with i from 1 to count of documents

 

                    set myFiles to active document

                    tell myFiles

                              try

                                        try

                                                  set theListOfColors to (every swatch whose model is spot and name begins with "P 555")

                                                  set properties of item 1 of theListOfColors to {model:process, space:CMYK, color value:{0, 0, 0, 100}}

                                        end try

 

 

                                        try

                                                  set ListOfColors to (every swatch whose model is process and name begins with "P 555")

                                                  set properties of item 1 of ListOfColors to {model:process, space:CMYK, color value:{0, 0, 0, 100}}

                                        end try

 

                                        try

                                                  set (model of every color whose model is spot) to process

                                        end try

 

 

                              on error the error_message number the error_number

                                        set the error_text to "Error: " & the error_number & ". " & the error_message

  display dialog the error_text buttons {"OK"} default button 1

                                        return the error_text

                              end try

                    end tell

 

          end repeat

end tell

TOPICS
Scripting

Views

467

Translate

Translate

Report

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
Advocate ,
Sep 24, 2013 Sep 24, 2013

Copy link to clipboard

Copied

I'm no AppleScripter, but it seems to me that if you go to the trouble of setting up a variable I to walk through the documents you should use it.

I'd say it's bad form to use "myFiles" as the name for a variable that holds a reference to a single document.

Someone might need to backstop my code, but you should be able to use:

repeat with myDoc in documents

tell myDoc

Dave

Votes

Translate

Translate

Report

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 25, 2013 Sep 25, 2013

Copy link to clipboard

Copied

LATEST

Nellbern,

In the statement "set myFiles to activeDocument", myFiles holds only one document eventhough the loop is running properly. Please try as Dave said else change your code to loop throught the each documents properly.

~Green4ever

Votes

Translate

Translate

Report

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