Code
--ver 0 by ?
--ver 1 by BK, added current, changed defaults and max
options = dialog.CreateDialog("Options")
options.x1 = dialog.AddLabel("For any of ")
options.enable1 = dialog.AddCheckbox("enabled bands",true)
options.disable1 = dialog.AddCheckbox("disabled bands",false)
options.str1 = dialog.AddSlider("with strength" ,0 ,0 ,5 , 1)
options.len1 = dialog.AddSlider("with length" ,0 ,0 ,5 , 1)
options.x2 = dialog.AddLabel("- do them:")
options.remove2 = dialog.AddCheckbox("remove",false)
options.disable2 = dialog.AddCheckbox("disable",false)
options.enable2 = dialog.AddCheckbox("enable",false)
options.str2 = dialog.AddSlider("Set Strength" ,0 ,0 ,5 , 1)
options.x3 = dialog.AddLabel("OR multiply current strength by:")
options.strmult2 = dialog.AddSlider("-multiplier " ,0 ,0 ,2 , 2)
options.len2 = dialog.AddSlider("Set length" ,7 ,0 ,10 , 1)
options.curlen2 = dialog.AddCheckbox("OR set current length",false)
options.okay = dialog.AddButton("Okay",1)
dialog.Show(options)
enable1=options.enable1.value
disable1=options.disable1.value
str1=options.str1.value
len1=options.len1.value
remove2=options.remove2.value
disable2=options.disable2.value
enable2=options.enable2.value
str2=options.str2.value
strmult2=options.strmult2.value
len2=options.len2.value
curlen2=options.curlen2.value
bcount=band.GetCount()
allbands={}
print("Disabled or changed strength for a group of bands")
--print("enable1:",enable1, "; str1-2:",str1, " ", str2, "; disable2:",disable2, "; remove2:",remove2)
for i=1, bcount do
if enable1 then
if band.IsEnabled(i) then
allbands[i]=7
--print ("Band is enabled:", i)
end
end
if disable1 then
if band.IsEnabled(i)==false then
allbands[i]=7
--print ("Band is disabled:", i)
end
end
if str1~=0 then
if (band.GetStrength(i)>str1-.01) and (band.GetStrength(i)<str1+.01) then
allbands[i]=7
--print ("Band str is equal: ", i)
end
end
if len1~=0 then
if (band.GetGoalLength(i)>len1-.01) and (band.GetGoalLength(i)<len1+.01) then
allbands[i]=7
--print ("Band str is equal: ", i)
end
end
end
for i=1, bcount do
if allbands[i]==7 then
if disable2 then band.Disable(i) end
if enable2 then band.Enable(i) end
if str2~=0 then
band.SetStrength (i,str2)
elseif strmult2~=0 then
band.SetStrength (i,band.GetStrength(i)*strmult2)
end
if curlen2 then
band.SetGoalLength (i,band.GetLength(i))
elseif len2~=0 then band.SetGoalLength (i,len2)
end
end
if (allbands[bcount-i+1]==7) and (remove2) then
--print("removed: ", i)
band.Delete(bcount-i+1)
end
end