Indesign Dialog user interface - help with script

Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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

Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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

