PDA

View Full Version : Scripting help - switchQuant change


howldin
12-08-2009, 01:50 PM
Hi folks. I am finally starting to write a few, pretty basic scripts and am having only intermittent success. I suspect this question will be easily answered.

One script I want is one that is triggered by an FCB switch, to cycle through 3 settings of switchQuant: loop, cycle, and subcycle. My first attempts used else and if statements, but didn't work. Then I realized I need a Variable statement.

All the presets I use have switch quantize set to subcycle. The following script works to change it to cycle. that is helpful but not what I stated above as the goal. I have not been able to get a script to work that does the cyclic swapping. Suggestions, anyone?

!name switchquantswapper
!focuslock
!autoload

Label SQSwap

Variable saveswitchQuant $switchQuant
set switchQuant cycle
Message switchQuant cycle
end
set switchQuant $saveswitchQuant
endif

Many thanks in advance,
Hal Dean

Jeff
12-08-2009, 10:31 PM
You don't need variables for this, you can use if/else.


!name switchquantswapper

if switchQuant = subCycle
set switchQuant cycle
else if switchQuant = cycle
set switchQuant loop
else
set switchQuant subCycle
endif


One thing to note about using "set" in scripts. This is a temporary
override to what is in the preset. If you cause the preset to be changed
or re-selected in the UI, then this will cancel the overrides and the
parameter will return to what it is in the preset.