2

I'm trying to get the value of a check box in ApplescriptObjC.

    on goClicked_(sender)

        set checkBoxValue to checkBox's stringValue as boolean

    end goClicked_

This code doesn't work. Any ideas?

jweaks
  • 3,674
  • 1
  • 19
  • 32
James
  • 213
  • 1
  • 3
  • 13
  • Say more about your context. Is this a handler in an ASObjC app in Xcode, and the checkbox is in the window you've built in IB? If so, you will/should have setup either an outlet or a property binding. – jweaks Oct 29 '14 at 04:01
  • I have the outlets and such. I also have everything hooked up. I'm now just trying to get the value of the checkbox I put on my UI. Like true or false or 1 or 0. – James Oct 29 '14 at 15:17
  • Trying your code with outlets set correctly Xcode gives me `-[AppDelegate goClicked:]: Can’t make stringValue of ... id ... into type boolean.` without the _as boolean_ it answers 0 and 1 – ShooTerKo Oct 29 '14 at 20:51

1 Answers1

2

If checkBox is set as an outlet, then you can get its state [0/1] with:

set checkBoxValue to (checkBox's state())
jweaks
  • 3,674
  • 1
  • 19
  • 32