Page 1 of 1

Button script.

Posted: Sun Feb 21, 2010 11:44 am
by Teh-B
Hi. I'm newbie in scripting.

Because of some features of my midi-controller I would like to create a button in module which will turn on/turn off a checkbox.
First push - turn on.
Then release of the button make nothing.
Second push - turn off etc...


I created a button with massage OnOff and tried to use next script:

if msg == 'OnOff':
parameter = module.getValue ('NameOfCheckbox',0)

if parameter == 0 :
module.setValue ('NameOfCheckbox', 0,1)
else :
module.setValue ('NameOfCheckbox', 0,0)



But with this script when I push the button checkbox turns on
but when I release the button checkbox turns off.

Which code should I use?

Posted: Mon Feb 22, 2010 7:10 am
by Teh-B
I've found the answer:


value = param['value']

if msg == 'OnOff' and value != 0:

OnOffAParam = module.getValue ('enabled1',0)


if OnOffAParam == 0 :
module.setValue ('enabled1', 0,1)

else :
module.setValue ('enabled1', 0,0)