Binding checkbox to shared user defaults - how to get the checkbox's s


I start to explore the possibilities of Xcode and applescriptobjC. I have no knowledge of C / objective C.
I made a program to import excel files containing contacts or meetings into Contacts or Calendar. It works fine. To progress, I want to add the ability to remember the state of a checkbox (in a plist file).

With the help of Shane Stanley’s book, I managed to bind the checkbox to “Shared User Defaults Controller”.
The “Controller key” is set to “values”. The Model Key Path is set to a name “CheckStateBox”.

What I don’t understand is how can I get and utilize the state of the check box in my script ?

Thanks for your help,


if (chaeckBox’s state as integer) = 1 then
– put your code here
end if


Thanks for the reply.

I still don’t understand.

Property CheckStateBox is not declared at the beginning of the script.
If I want to use “CheckStateBox”, I have an error message (the variable CheckStateBox is not declared)

If I try to declare property CheckStateBox (as missing value or true or false), how can I make a link between this property and the binding (from the checkbox to “Shared User Defaults Controller”) ?

Best regards,


you cannot bind a property in the script and a property of an UI element at the same time to User Defaults.

Either bind the UI element, then retrieve the value with NSUserDefaults’s standardUserDefaults()'s integerForKey_()
Or bind the script property to the UI element, then load/save the value from/to User Defaults programmatically


I understand and it works perfectly !

Best regards,