2 Replies Latest reply on Jun 26, 2009 6:05 AM by wreyfmonkey

    [AS] "Without Showing Window" is Still Showing Window

    wreyfmonkey

      Hi all,

       

      I am trying to process a batch of InDesign CS3 files and when I use the "without showing window" command, the script executes as expected, except that it does display the window as the script runs.  I think I could pick up some major speed gains if I could keep the window in the background, but it would appear the script is not obeying that command.

       

      In truth, this command has never worked for me and I am beginning to wonder if a preference setting I may have locally could be overriding the AS command. 

       

      The script below is a simplified excerpt from my script.  Note that I have an open Finder window and am processing all the InDesign files in that window.

       

      Any ideas or suggestions?  Thanks in advance!!

       

       

       

       

      tell application "Adobe InDesign CS3"

      set user interaction level of script preferences to never interact

      tell application "Finder"

      set theFolder to window 1

      set theNumber to count (items in theFolder whose name ends with ".indd")

      end tell

       

      --begin processing the files in the open window

      repeat with i from 1 to theNumber

      open (item i of theFolder whose name ends with ".indd") without showing window

      --do stuff

      close document 1 saving no

      end repeat

      end tell

        • 1. Re: [AS] "Without Showing Window" is Still Showing Window
          sstanleyau Level 4

          Your problem is that your code is passing Finder references to InDesign. InDesign doesn't understand Finder references, so it throws them back to the Finder, which then does the opening -- it's as if you double-clicked on the file.

           

          You need to pass InDesign an alias or path, like this:

           

          tell application "Finder"

          set theFolder to window 1

          try

          set theFiles to (every file in theFolder whose name ends with ".indd") as alias list

          on error -- happens if there's only one

          set theFiles to (every file in theFolder whose name ends with ".indd") as alias as list

          end try

          end tell

           

          tell application "Adobe InDesign CS3"

          set user interaction level of script preferences to never interact

          --begin processing the files in the open window

          repeat with i from 1 to count of theFiles

          open (item i of theFiles) without showing window

          --do stuff

          close document 1 saving no

          end repeat

          end tell

           

           

          --

          Shane Stanley <sstanley@myriad-com.com.au>

          AppleScript Pro Sessions <http://scriptingmatters.com/aspro>

          • 2. Re: [AS] "Without Showing Window" is Still Showing Window
            wreyfmonkey Level 1

            ...And circle gets the square!

             

            Nice work as always, Shane.  That one had been perplexing me for a while now, but when you explain it, it makes complete sense and I should have realized that passing the references back and forth that way would muddy the waters.  Today I will be going back and fixing that on a ton of my scripts.  Thanks a lot, Shane!!