I have been attempting to run an applescript that will allow me to creat a rectangle in VectorWorks just by entering a couple of variables. I have run into a problem. I can get the program to open, select the rectangle tool, enter the dimensions and then I get stuck. I have attempted to get the script to click the checkbox that is automatically selected to position the rectangle at the next click so that I could just enter the location that I want the rectangle to be in, but the click happens and does not deselect the check box. I have tried to set the value of the checkbox to “0” to have it be deselected as well. I have also tried to go a different route and have it position the rectangle at the next click and then have the UI click into the window, with no luck either.
Any ideas?
tell application "Finder"
activate
display dialog "What Size Rectangle Would You Like To Make?" & return & return & "A" default answer "" buttons {"Cancel", "OK"} default button 2
if the button returned of the result is "OK" then
set the a1 to the text returned of the result
display dialog "B" default answer "" buttons {"Cancel", "OK"} default button 2
if the button returned of the result is "OK" then
set the b1 to the text returned of the result
end if
end if
end tell
delay 1
tell application "Finder"
activate
open document file "COVER DEFAULT" of folder "Desktop" of folder "beibert" of folder "Users" of startup disk
tell application "VectorWorks"
activate
--tell application "System Events"
--keystroke "w" using {command down}
--end tell
delay 2
tell application "System Events"
keystroke "rr"
delay 2
keystroke b1
delay 1
keystroke tab
keystroke a1
delay 1
(*keystroke tab
keystroke "24'"
delay 1
keystroke tab
keystroke "8'"*)
delay 1
(*set value of checkbox "Position At Next Click" of window "Create Rectangle" of process "VectorWorks" to "0"
*)
delay 1
--click checkbox "Position At Next Click" of window "Create Rectangle" of process "VectorWorks"
delay 1
keystroke return
tell process "VectorWorks"
click at {500, 500} (*window of process "VectorWorks" at {100, 100}*)
end tell
end tell
end tell
end tell