3 Replies Latest reply on Jan 12, 2010 6:20 PM by sstanleyau

    Indesign Dialog user interface - help with script

    DawidRuzica Level 1

      Hi , I am very new to apple script and found this web site forum here , maybe I can get help:)

       

      I am trying to write a script in apple script to pop up a dialog that would as user where to save that file he/she is working on

       

      here is my example non working script

       

       

      tell document 1

       

      set myName to name

      set myFirstColumnWidth to 150

      set myDialog to make dialog with properties {name:"Print"}

      tell myDialog

      tell (make dialog column)

      --First Panel Border start

      tell (make border panel)

      tell (make dialog column)

       

       

       

      --Options for a text size

      set myTextSizeList to {"Folder1", "Folder2", "Folder3"}

      tell (make dialog row)

      tell (make dialog column)

      make static text with properties {static label:"Book Title:", min width:myFirstColumnWidth}

      end tell

      tell (make dialog column)

      set myTextSizeDropdown to make dropdown with properties {string list:myTextSizeList, selected index:5, min width:200}

      end tell

      end tell

       

      end tell

       

      end tell

      end tell

      end tell

       

       

       

      set myResult to show myDialog

      if myResult is true then

       

       

       

      if selected index of myTextSizeDropdown is 0 then

      save to "Server:Server Space:PDF1:" & myName

      else if selected index of myTextSizeDropdown is 1 then

      save to "Server:Server Space:PDF2:" & myName

      else if selected index of myTextSizeDropdown is 2 then

      save to "Server:Server Space:PDF3" & myName


      end if

      end if

      end tell

      end tell

       

       

       

       

      also any possibility to do save a copy in applescript ? that would be even better. Any help is very much appreciated.

       

      thank you

       

      Dawid

        • 1. Re: Indesign Dialog user interface - help with script
          sstanleyau Level 4

          Your problem is that you're trying to make the dialog at the document rather than application level. Try this:

           

          tell application "Adobe InDesign CS4"

          tell document 1

          set myName to name

          end tell

          set myFirstColumnWidth to 150

          set myDialog to make dialog with properties {name:"Print"}

          tell myDialog

          tell (make dialog column)

          --First Panel Border start

          tell (make border panel)

          tell (make dialog column)

           

          --Options for a text size

          set myTextSizeList to {"Folder1", "Folder2", "Folder3"}

          tell (make dialog row)

          tell (make dialog column)

          make static text with properties {static label:"Book Title:", min width:myFirstColumnWidth}

          end tell

          tell (make dialog column)

          set myTextSizeDropdown to make dropdown with properties {string list:myTextSizeList, selected index:5, min width:200}

          end tell

          end tell

           

          end tell

           

          end tell

          end tell

          end tell

           

          set myResult to show myDialog

          if myResult is true then

           

          tell document 1

          if selected index of myTextSizeDropdown is 0 then

          save to "Server:Server Space:PDF1:" & myName

          else if selected index of myTextSizeDropdown is 1 then

          save to "Server:Server Space:PDF2:" & myName

          else if selected index of myTextSizeDropdown is 2 then

          save to "Server:Server Space:PDF3" & myName

          end if

          end tell

          end if

          destroy myDialog

          end tell

          You can't do a copy save directly; you'd need to do a save, close the document, and reopen the original.

          • 2. Re: Indesign Dialog user interface - help with script
            DawidRuzica Level 1

            Yes that worked! Thank you very much.

            since I can not use save copy with applescript, how would I write a script to save original in current location (it already has a name and location) then do the above script (save as)

             

            close

             

            and here is what I don't know: "open that original again" ?

             

            thank you

            • 3. Re: Indesign Dialog user interface - help with script
              sstanleyau Level 4

              Roughly:

               

              set fullPath to full name of document 1

              save document 1 to fullPath

              -- do your save as here

              close document 1 saving no

              open fullPath