Button script.
  • Teh-B
    junior Member
    Posts: 3
    Joined: Sun Feb 21, 2010 5:08 am

    Button script.

    by Teh-B » Sun Feb 21, 2010 11:44 am

    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?
  • Teh-B
    junior Member
    Posts: 3
    Joined: Sun Feb 21, 2010 5:08 am

    by Teh-B » Mon Feb 22, 2010 7:10 am

    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)

Who is online

Users browsing this forum: No registered users and 13 guests