XCode Applescript Checkbox State

I am trying to set the state of a checkbox based on a variable. I can find tons of example on how to do it all in cocoa, using IBOUtlets etc, but I am creating an AppleScript Application, so I need to do it with AppleScript. I cannot find it in the documentation, and have searched for hours.

things I have tried (as well as various iterations):


--set value of checkbox "twiCheck" to 0
--tell twiCheck to setNextState_()
--set twiCheck to state of button 1
--set fooBarz to 0
--tell twiCheck to setIntegerValue_(fooBarz as integer)
--tell twiCheck to setEnabled_(false)
--my twiCheck's setEnabled_(false)
--set state of button twiCheck to 0
--set string value of button twiCheck to "0"
--twiCheck's setstate_(current application's NSOffState)
--twiCheck's setNextState(0)
tell twiCheck to setStringValue_("Unchecked")

I have the checkbox ‘hooked up’ in Interface builder, and have declared the checkbox as a property

property twiCheck : missing value

Help me Obi Wans You are my only hopes

Are you programming in AppleScript Studio (in 10.5 and previous) or AppleScriptObjC (10.6 and up)? Because connections in IB the way you want to use them are not supported prior to 10.6. You have to give it a name in the applescript tab of the inspector in IB and call it like this in your code:

set checkState to state of button "myCheckBox" of window "mainWindow" as boolean

Sadly with 10.5 and less Xcode, you have to name everything you wish access to. 10.6 solved this by letting us do it like the pros in Objective C! :slight_smile:

Regards,
Fred

Browser: Safari 531.9
Operating System: Mac OS X (10.6)