checkbox question


Why is it that if I open a window from a menu item:

on choose menu item theObject
	if title of theObject is "Window" then
        set (state of button "checkbox1" of window "preferences") to false
end choose menu item

and run the app, it works file when i select the window-- and it deselects the checkbox…

Yet if i close the window and select it again from the menu item bar, I get

NSReceiverEvaluationScriptError : 4 (1)


Are you wanting a menu item to just open another window?

I am wanting it to affect the state of a button…

You can do this without any code. First, watch this video. It demonstrates using a menu item to open a window. You will do a similar operation, except that you will drag from the menu item to your checkbox, and then choose “performClick:”.