0
Answered

Level value in two digits

lucian 9 years ago in General updated by Ekaterina (head of support) 9 years ago 2
I need to send a volume command from a level (min 0, max 38).
The command is '<11VOxx',x0D where xx is the value for the volume. For the first 9 digits the value from the level is 0,1,2 ...9, but I need to send 00,01,02 ... 09. How can I get the value from the level in two digits, for the first 9 values?

Thank you
Under review
function lev () {
   var level = IR.GetItem("Page 1").GetItem("Item 1").Value

   if (level < 10) {var level = "0"+level.toString(); IR.SetVariable("Tokens.Lev", level)}
   else {IR.SetVariable("Tokens.Lev", level.toString())}
}
Something like this?