Run in all open docs

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

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

Similar Messages

  • Export all open docs as PDF

    I am working on a script which should export all the open docs as PDF.
    I use the following script to export. but InDesign does not export all the PDF. Assume, I have opened seven docs and the script exports only 4 docs and again come back to the first exported doc. can any one help how to resolve the issue.
    var myTotalDocs = (app.documents.length);
        for(var i = 0; i < myTotalDocs; i++)
            myDocument = app.documents[i];
            app.activeDocument = myDocument;
            var myFilePath = app.activeDocument.filePath;
           app.activeDocument.exportFile(ExportFormat.pdfType, File(myFilePath+"/"+".pdf"),false);
    Thanks

    Dear Ramji
    Please use the below code for solving your problem:
    //===================== Start : Export =================================//
    var myTotalDocs = (app.documents.length);
        for(var i = 0; i < myTotalDocs; i++)
            myDocument = app.documents[i];
            app.activeDocument = myDocument;
            var myFilePath = app.activeDocument.filePath;
           app.activeDocument.exportFile(ExportFormat.pdfType, File(myFilePath+"/"+".pdf"),false);
        myDocument.close(SaveOptions.NO);
    //===================== End: Export =================================//
    Once Export the InDesign open document then immediatly close... otherwise this problem [what you menditoned] will occure.
    Thanks & Regards
    T.R.Harihara SudhaN

  • AppleScript to run on ALL opened Pages document instead of Active one.

    Hello,
    I have many AppleScript i'm running on the active Pages document... but If I would like to run the Script on ALL opened Pages document?
    What would be the line to add/modified at the top?
    Thanks in advance...
    Example of a script running on the active Pages document.
    set theTargetWords to {"www.network"}
    tell application "Pages" to activate
    tell application "System Events" to tell process "Pages"
      -- Open the "Find & Replace" window:
      keystroke "f" using command down
         repeat until exists window "Find & Replace"
         end repeat
         tell tab group 1 of window "Find & Replace"
      -- Adjust the settings:
      click radio button 2 -- Advanced
              if value of checkbox 2 is 1 then click checkbox 2 -- Don't match case
              if value of checkbox 3 is 1 then click checkbox 3 -- Whole words
              if value of checkbox 1 is 0 then click checkbox 1 -- Search previous text (loop)
      click pop up button 1 -- find in
      click menu item 1 of menu 1 of pop up button 1 -- Entire document
      click pop up button 2 -- replace style
      click menu item 1 of menu 1 of pop up button 2 -- Any
      -- Delete every target word:
              set value of text area 1 of scroll area 2 to ""
              repeat with thisWord in theTargetWords
                   set value of text area 1 of scroll area 1 to thisWord -- the target word
                   click button "Replace All"
              end repeat
         end tell
    end tell

    I have many AppleScript i'm running on the active Pages document... but If I would like to run the Script on ALL opened Pages document?
    What would be the line to add/modified at the top?
    Try this:
    tell application "Pages"
        activate
        tell application "System Events" to set theOpenWindows to windows of process "Pages" whose subrole is "AXStandardWindow"
        repeat with thisWindow in theOpenWindows
            tell application "System Events" to tell thisWindow to perform action "AXRaise"
            tell front document
                -- ENTER YOUR CODE HERE
            end tell
        end repeat
    end tell

  • Acrobat 10 - Where's the print all open docs function?

    In Acrobat 9 I was able to go to Advance->Batch Sequences->Print All
    Then all of the documents that were opened would be printed, and if you wanted to it could Print All without saving.  This was a very useful feature that I no longer have access to.   I have to confirm every document I wanted printed and I don't see an option to print all opened documents.
    Am I missing something?
    -PixelMuse

    Batch processing has been removed from Acrobat X - instead there are Actions.
    While it's possible to replicate the "print all open files" sequence to some extent, the interactivity of Actions is different, so it can't work seamlessly. For that reason it isn't in the default set of actions shipped with Acrobat X.

  • Issues running Crystal Reports (Open Doc) from IE 9 with locale not set to English

    Hello Experts.
    This thread is more or less a sub thread of http://scn.sap.com/thread/3541526 .  We continue to experience Crystal Report failures from a location in China when our users enter report parameters and click execute.  The error message we are seeing is: “logon information for this report is either incomplete or incorrect Error code:0 [CRWEB00000119]” (in Chinese).
    After a fair amount of troubleshooting (see aforementioned thread) we discovered that the reports would not only run fine in Firefox, from this location, while set to a  Chinese Language, but if we changed IE to US English, the reports ran from there as well.
    While we have narrowed down the issue we have not been able to find a viable solution.  Firefox is not ideal because it does not run many of our other application properly, including some SAP products and switching browser locale settings from user’s native languages to run a report is also not ideal.  Has anyone else run into this issue in the past, if so how did you work through / around it.  Any help or suggestions will be greatly appreciated.
    Some environmental information
    - We are currently running BOBJ 4.0 SP 4
    - We have a test environment running BOBJ 4.1 SP 2 and the issue is persistent
    - We run IE 9 throughout our organization as a requirement for most of our internal tools

    Hi Apporv
    Please check your database documentation for error 31400.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Run applescript on all open documents

    hi all,
    I have an applescript that was created to run on the active document. I dont have any applescript abilites but would like to change it to run on all open documents. the script removes all unused master pages and i would like it to run on all opened docs. what do i need to change to make it work?
    here is the script....
    set moreMasters to {}
    tell application "Adobe InDesign CS3"
        tell document 1
            set allMasters to every master spread
            set theMasters to applied master of every page
            repeat with x in theMasters
                set end of moreMasters to applied master of x
            end repeat
            set theMasters to theMasters & moreMasters
            repeat with x in allMasters
                if x is not in theMasters then delete x
            end repeat
        end tell
    end tell
    thanks in advance
    Dan

    Rather than using the numeric index, you can also leave that to AppleScript.
    tell application "Adobe InDesign CS4"
         repeat with doc in documents
              tell doc
                   set theName to name -- of doc
                   display dialog theName
              end tell
         end repeat
    end tell

  • Command in Java for "all opened documents"

    I have a script that needs modification. Thank you all in the forum for helping me design this script from start btw!
    Anyway, this is the script.
    var myDoc = app.activeDocument;
    app.findGrepPreferences = app.changeGrepPreferences = null;
    // Change "Condition 1" to name of your condition
    myConditionList = app.activeDocument.conditions.everyItem().getElements();
    for (i=myConditionList.length-1; i>=0; i--)
        if (myConditionList[i].visible == false)
            myConditionList[i].visible = true;
            app.findGrepPreferences.appliedConditions = [myConditionList[i].name] ;
            app.findGrepPreferences.findWhat = ".+";
            myDoc.changeGrep();
            app.activeDocument.conditions.item(myConditionList[i].name).remove();
    I'm looking for a variable that can apply for "all" opened documents rather than the active one only. I'm having difficulty finding the right command.
    BTW, the script removes all hidden text and objects.

    Programming has never been my strong side. Never understood it properly and probably never will =(. But thank you solving it. The code "JUMO_OVER" wrote, worked like charm. No need to execute the script 10x for 10 documents.
    Pardon me for giving you guys more out headaches, I have two additional scripts that needs revision for the same purpose as above, i.e. able to exceute the scrip for all opened docs, saved or unsaved. I would really appreciated if you guys could help me convert them. I tried it do it on my own own, but I can't get it working... =(
    Delete Empty Frames in active doc
    var myStories = app.activeDocument.stories.everyItem().getElements();
    for (i = myStories.length - 1; i >= 0; i--)
        var myTextFrames = myStories[i].textContainers;
        for (j = myTextFrames.length - 1; j >= 0; j--)
            if (myTextFrames[j].contents == "")
                myTextFrames[j].remove();
    Delete Empty Pages in active doc
    app.doScript("main()", ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT,"Remove  Blank Pages");
    function main () {
        if (app.documents.length === 0) {
            alert ("Please open a document.");
            return;
        app.scriptPreferences.enableRedraw = false;
        removeBlankPages (app.Documents);
        app.scriptPreferences.enableRedraw = true;
        function removeBlankPages (doc) {
            var pages = doc.pages.everyItem().getElements().slice(0);
            var i = pages.length;
            while (i-- >1) { // a bit quicker here
                !pages[i].allPageItems.length && pages[i].remove ();
            !pages[i].allPageItems.length && pages[i] != doc.pages[-1] && pages[i].remove ()
    BTW, I didn't write them. So they may look quirky in your eyes.

  • Installed iWork '09 on MacBook running OSX 10.7.2 and Pages won't open .doc files. Why?

    I just recently installed iWork '09 on MacBook running OSX 10.7.2 and Pages won't open .doc files.
    I did a search looking for a solution in the forums and here are the actions I've taken:
    1) Made sure the files were't read/write protected.
    2) Restarted the computer.
    3) Made sure all the program files were in the correct folder.
    4) Reinstalled the program.
    Pages won't read .doc files that were originally Pages files and exported as .docs
    It also won't read .doc files that were created using a relatively recent version of Office.
    Does anyone have any idea what's going on?
    Please help.

    If it's a doc created with the late Office 2011, it's not really surprising.
    The importer embedded in iWork application was delivered in january 2009 and didn't evolve.
    For this reason, it's unaware of new features delivered with Office 2011.
    Better try with LibreOffice.
    Yvan KOENIG (VALLAURIS, France) vendredi 3 février 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

  • HT2693 My Pages App will not open after I recently updated it. I'm afraid to lose all my docs if I delete the App and re-install.

    My Pages App will not open after I recently updated it. I'm afraid to lose all my docs if I delete the App and re-install.

    First of all - you are running the proper iOS in order to use the latest version of Pages - correct? You need iOS 6 now.
    If so ....See if this helps. Maybe Pages will open after you try this.
    Quit the Pages app completely and restart the iPad. Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar. Restart the iPad.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Or ..... Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    If that didn't help backup and send your files into iTunes with file sharing.
    You could lose all of your files if you delete and reinstall the app. That is precisely why you should backup your iPad and send your files into iTunes using files sharing on the iPad. Do you backup or use file sharing?
    Backup your iPad, send the files from the iPad into iTunes using file sharing and then delete the app and reinstall it.
    Start here ..... How to backup and restore from a backup
    http://support.apple.com/kb/HT1766
    iOS: About file sharing.
    http://support.apple.com/kb/HT4094

  • I have a brand new macbook pro 15" with latest Lion.Can anyone tell me why, when I open word or preview etc that multiple files open?For eg if I open a word doc, the last 1-3 docs that I have worked on all open. why?

    I have a brand new macbook pro 15" with latest Lion. Can anyone tell me why, when I open word or preview etc that multiple files open?For eg if I open a word doc, the last 1-3 docs that I have worked previously on all open. Can anyone tell me why?

    You have a choice as to whether or not applications in Lion like Word or Preview (or even Safari) save and re-open previous documents or windows... just hold down the option key while quitting a program and when you re-open it you won't get the previous documents or windows when you re-open the application. You can see this by selecting the open program in the menu bar and when holding down the option key the quit function will change to quit and discard open windows. This feature in Lion is referred to as "Resume" and is great if you want to restart an app and return to what you're doing (for example in Safari re-opening existing windows and tabs from your previous session). You still have the option to close individual windows within an app before quitting and they will not re-open when the app is launched again.
    This Resume function is not related to saving your work (a word or text document for example). This is handled by Lion's "Auto-Save" and "Versions" functions. See http://www.apple.com/ca/macosx/whats-new/auto-save.html
    Hopefully this is the complete answer you're looking for.

  • IPad running iOS 5 has on the menu bar only have 4 icons, being: back, forward, bookmarks, and the "add to bookmarks", but is missing an icon after the "add to bookmarks" arrow, that is a "show all open browser windows" icon. How do I get it in my safari?

    iPad running iOS 5 has on the menu bar only have 4 icons, being: back, forward, bookmarks, and the "add to bookmarks", but is missing an icon after the "add to bookmarks" arrow, that is a "show all open browser windows" icon. How do I get it in my safari?

    What you are seeing is how Safari works now in iOS 5. There is no way to get that icon in Safari now. There other much better browsers available in the App Store. Look at iCab Mobile, Mercury, Atomic, ....
    I have been running iOS 5x for so long now, that I don't even remember if that icon did appear in earlier iOS versions

  • How To?  Default all Word Docs to Open In Pages?

    If I right click on a doc, I can select to always open THAT doc in Pages - but - is there a way I can set the system to open ALL Word docs in Pages. I want Word to be a last resort only.
    Thanks!
    Mark

    mctheriot,
    Yes, there is. Type cmd-I (Get Info), select Pages from the list (or navigate to it), then click the Change All button. That's all there is to it.
    -Dennis

  • I update my OS to Mount Lion and all my .docs ( microsoft office for mac) can't be read or open. Any advice on to what app should I get so I can open or transfer to so I can open em?

    I update my OS to Mount Lion and all my .docs ( microsoft office for mac) can't be read or open. Any advice on to what app should I get so I can open or transfer to so I can open em?

    What program did you use prior to the updade? Did you updrde that program when you updaded the OS?

  • Can I run an action on all open files?

    I'm converting some of my images to grayscale with an action. The images are spread across hundreds of folders and only some of the images need to be converted. I want to be able to look at the image to make sure it should be converted (or not, as the case may be). So I end up with, for a particular folder, maybe 20 open images.
    Then I run the action manually on each image that is still open.
    QUES: Is there a way to select "run action on all open images".
    I know I could do it in Batch by moving all the files to a new folder, but every time I try to re-learn how to batch (I only resort to batch every year or two), an hour later I'm still reading the Help manual and nothing has been accomplished. So, an action it has to be, or manually.

    Might be quicker to set the action to a hot key, open all files in the folder and then inspect them and if they need the action, hit the key, otherwise ctrl-w to close unchanged.

  • HT204053 Hi all, I am constantly running into problems opening iCloud services (mail, calendars, iWork's, etc.). I get a message stating i.e. Can't load Mail (Calendar, iWork), There was a problem loading the application. Does anybody know what a heck is

    Hi all, I am constantly running into problems opening iCloud services (mail, calendars, iWork's, etc.). I get a message stating i.e. Can't load Mail (Calendar, iWork), There was a problem loading the application. Does anybody know what a heck is going on?

        I can see that this issue has been quite extensive, and frustrating, and I am so sorry for all that has happened societygirl! I would like to help you work this issue out. Please follow & send me a Direct Message, so I can get your account specifics and help finally bring this to a resolution.
    Thank you,
    MichelleH_VZW
    Follow us on Twitter @VZWSupport

Maybe you are looking for

  • File-xi-rfc scenario

    Hi all, I am working on File-xi-RFC scenario. i have done IR and ID working. Now I have Done test cofiguration there is NO ERROR ......working File is picked .....as mode is delete.......working.. I check in Adapter Monitoring...............there i g

  • Delivery and Billing Info Cubes

    Hi gurus plz provide some standard Delivery and Billing Info Cubes which r available in bw system

  • [SOLVED]Color Bash Prompt help

    So I have been customizing my arch box and everything has been great except for one problem; the bash color prompt. I am kind of running a color screen where I am using the same shade of green, blues, grays, etc. I would like to continue that with my

  • An easy question about Solaris

    Hi All, I'm new in Solaris. Last week I found a rediculous problem in my system. I created a new directory named "test" under "/", and changed to the empty directory by "cd /test". Then I type "touch *" and get a new file named "*"!!! After that, I c

  • My canon p-150m scanner gives the error message "cannot load drivers" ever since updating to yosemite

    why does my canon p-150m scanner gives the error message "cannot load drivers" ever since updating to Yosemite ? I have had 2 reload the driver 2x - but each new time I start I keep getting the same error message .