I am trying to create guides in a chosen color in InDesign (developing in 2 and will recompile for CS and CS2). Stating the color works but choosing the color won’t.
THIS WORKS -
tell application “InDesign 2.0.2”
activate
tell document 1
make guide with properties {location:(leftTrim), orientation:vertical, guide color:red}
end tell
end tell
THIS DOESN’T
choose from list {“light blue”, “red”, “green”} with prompt “Pick a color:”
set theColor to result as text
tell application “InDesign 2.0.2”
activate
tell document 1
make guide with properties {location:(leftTrim), orientation:vertical, guide color:theColor}
end tell
end tell
What syntax am I missing to allow this to work? Thanks.
That is becouse the property of guide color is not a string.
set leftTrim to 75
choose from list {"light blue", "red", "green"} with prompt "Pick a color:"
set theColor to result as string
tell application "InDesign CS"
activate
tell document 1
if theColor is "light blue" then set theColor to light blue
if theColor is "red" then set theColor to red
if theColor is "green" then set theColor to green
make guide with properties {location:(leftTrim), orientation:vertical, guide color:theColor}
end tell
end tell
A suggestion, due to the changes made to ID from version 2 to CS and CS 2 you might want to write the scripts in the version that you plan on using them in. Adobe has made changes to the scripting support from version 2 that breaks scripts.
Okay, I have changed the type to string and the guide ignored the color variable. So I looked at your code and saw that you are coercing the data within an “if” statement. Why is this necessary if theColor = “the color”?
The reason I am developing and re-compiling is I support users on all versions.