How can I set my script to disable/enable a button

What I need to do is disable a button while a process is being performed as descibed below.

on clicked theObject
disable button
run function
----- function finnished
enable button

Simple I hope

Try this:

set enabled of button "myButton" of window "myWindow" to false