Manipulating buttons within a script, and reading there state

Hi,

I’m trying to make a small application to setup printers within my organization.
I have a number of check boxes for various printer names, some ‘select all’ push button for groups of printer types and a cancel and ok buton.
I think I’ll be fine making the script to create the printers, using a lpadmin command.

I have two problems though.

Firstly, what do I need to code to read the value of a check box to start a routine that makes the printer?
is it somthing like this:

on clicked theObject
if name of theObject is “ok” then
if state of button “checkbox1” is true then

end if
end if
end clicked

and Secondly I want to have a few Push buttons (or similar) that when clicked with enable some of the check boxes within the application.
e.g.
Push Button “Select All IP Printers”, and the checkbox for “IP Studio Laser”, “IP Creative Laser” & “IP Studio Proofer” become active.

basically how do I toggle the state of a check box if I click a different button.
I’ve tried various things to change the state of the box but I keep getting similar errors.

Applescript Error
Can’t make «class staB» of «class butT» “ip studio laser” into type reference. (-1700)

here’s the piece of script that the error comes from

on clicked theObject
if name of theObject is “select all ip” then
set state of button “ip studio laser” to true
display alert “at studio laser”
end if
end clicked

I bet its a very simple think, hope you can help
Thanks

Hi andy,

the script needs the reference of the button e.g.

set state of button "ip studio laser" of window "main" to true

Hi Stefan

Thats worked perfect, should be the same for the first part of the post aswell, just need to identify where the button lives.

Thanks
Andy