I keep getting a numeric result when trying to get the state of the drawer.
Here’s my code:
on clicked theObject
tell window “drawWin”
tell drawer “theDraw”
set currentState to state of it
log currentState
open drawer on right edge
end tell
end tell
end clicked
Here’s the log results:
2006-08-21 11:47:50.106 matrixTest[527] 1.685209939E+9
The drawer opens fine, I’m just not getting the state. Any ideas?
you are getting the state - it is an Applescript constant (one of: drawer closed/drawer closing/drawer opened/drawer opening). Unfortunately ‘log’ does not show the constant’s name but it’s value.
Here’s how the state can be used in your script to toggle the state on every click (for example):
on clicked theObject
tell window "drawWin"
tell drawer "theDraw"
set currentState to (state of it)
if currentState = drawer closed then
open drawer on right edge
else
close drawer
end if
end tell
end tell
end clicked