[Closed] Macroscript checkbutton state on toolbar
hi,
I’ve a problem with an script I’m writing.
I’ve made an macroscript “myExample” that works fine. There is a checkbutton on the toolbar and as long as the script is running the button is checked. The script stops when I uncheck the button. Thats working fine.
Now, I’ve made another script (startup) that checks some things in the max file and if it is needed it should run the macroscript “myExample”. That´s working fine too,but…
…when I run the macro with this command -macros.run “EGB Scripts” “myExample”- the macro starts but the checkbutton on the toolbar stays unchecked.
If the button were in a rollout it would have a name I could call. But my checkbutton hasn’t any…
Is there a way to control the state of this checkbutton?
Thanks!
here the startup script:
function ZE_checken =
(
file = maxFileName
file_Name = getFilenameFile file
ZE_theFileName = maxFilePath + (file_Name + “_ZE.txt”)
record_file = openFile ZE_theFileName mode:“r”
close record_file
if record_file == undefined then
(
messagebox "keine Zeit Erfassung Datei!"
)
else
(
rollout ZE_Rollout "dd"
(
button ZE_Start "E"
on ZE_Start pressed do
(
macros.run "EGB Scripts" "ZeitErfassung"
Global isOpen = false
–on isChecked return isOpen
)
)
Ze_Fenster = newRolloutFloater “Scripts” 180 150
addRollout ZE_Rollout Ze_Fenster
)
)
callbacks.removeScripts id:#ZE
callbacks.addscript #filePostOpen “ZE_checken()” id:#ZE
Check out the updateToolbarButtons() function which can be used to update the states of all MacroScripts currently on toolbars.