tglogo.png

Downloading File

Filename: Groups Control Dialog
menu channel,status {
  [Groups]: dialog $iif($dialog(groups), -v, -m) groups groups
}
dialog groups {
  title Groups Control
  size -1 -1 150 40
  text "Groups", 3, 5 40 130 30, center
  list 1, 5 60 140 130, vsbar 
  button "Expand", 2, 5 7 140 25
  edit "", 4, 5 174 75 22, autohs center read
  button "On" 5, 85 172 30 25
  button "Off" 6, 115 172 30 25
}
on *:dialog:groups:*:*: {
  if ($devent == init) {
    dialog -s $dname 791 2 150 40
    did -b $dname 5,6
    grps
  }
  if ($devent == sclick) { 
    if ($did == 1) { 
      did -ra $dname 4 $did(1).seltext 
      if ($group($did(1).seltext).status == on) { did -e $dname 6 | did -b $dname 5 } 
      if ($group($did(1).seltext).status == off) { did -b $dname 6 | did -e $dname 5 }
    }
    if ($did == 2) { 
      did -ra $dname 3 Groups ( $+ $did(1).lines $+ )
      if ($dialog(groups).h == 72) { did -r $dname 1 | grps }
      $iif($dialog(groups).h == 72, dialog -s $dname 791 2 150 200, dialog -s $dname 791 2 150 40) 
      $iif($dialog(groups).h != 72, did -ra $dname 2 Shrink, did -ra $dname 2 Expand) 
      if ($dialog(groups).h != 72) { did -b $dname 5,6 | did -r $dname 4 | did -u $dname 1 }
      if ($dialog(group2)) { dialog -x group2 | unset %grp | $iif($exists(timers.txt), .remove timers.txt) }
      if ($did(2).text == Shrink) { tmrs }
      if ($did(2).text == Expand) { if ($dialog(group2)) { dialog -x group2 } | unset %grp | $iif($exists(timers.txt), .remove timers.txt) }
    }
    if ($did == 5) { .enable $did(1).seltext | did -b $dname 5 | did -e $dname 6 }
    if ($did == 6) { .disable $did(1).seltext | did -b $dname 6 | did -e $dname 5 }
  }
}
alias grps {
  var %t 1
  while (%t <= $group(0)) {
    set %groups $sorttok($addtok(%groups,$group(%t),32),32,a)
    inc %t
  }
  didtok groups 1 32 %groups
  unset %groups
}
dialog group2 {
  title Groups Control 2
  size -1 -1 200 240
  list 1, 5 25 190 90, check
  list 2, 5 130 190 90, check
  text "Variables", 3, 5 5 190 15, center
  text "Timers", 4, 5 113 190 15, center
  button "Del Vars", 5, 5 217 85 20
  button "Del Timers", 6, 110 217 85 20
}
on *:dialog:group2:*:*: {
  if ($devent == init) { did -b $dname 5,6 }
  if ($devent == close) { unset %grp | $iif($exists(timers.txt), .remove timers.txt) }
  if ($devent == sclick) { 
    if ($did == 1) { 
      if ($did(1).seltext) { did -e $dname 5 }
      if ($did(1).csel = 0) { did -b $dname 5 | did -uk $dname 1 | unset %grp }
      if ($did(1).sel >= 1) {
        if ($did(group2,1,$did(group2,1).sel).cstate == 1) { set %grp $addtok(%grp,$did(1).seltext,32) }
        if ($did(group2,1,$did(group2,1).sel).cstate == 0) { set %grp $remtok(%grp,$did(1).seltext,32) }
      }
    }
    if ($did == 2) { 
      if ($did(2).seltext) { did -e $dname 6 }
      if ($did(2).csel = 0) { did -b $dname 6 | did -uk $dname 2 | .remove timers.txt }
      if ($did(2).sel >= 1) {
        if ($did(group2,2,$did(group2,2).sel).cstate == 1) { $iif($did(2).seltext !isin $read(timers.txt), write timers.txt $did(2).seltext) }
        if ($did(group2,2,$did(group2,2).sel).cstate == 0) { write -ds $+ $did(2).seltext timers.txt }
      }
    }
    if ($did == 5) {
      if (%grp != $null) {
        tokenize 32 %grp
        unset $1-
        unset %grp
        dialog -x group2
        tmrs
      }
      if (%grp == $null) { did -b $dname 5 }
    }
    if ($did == 6) { 
      var %t = 1
      while (%t <= $read(timers.txt)) { 
        .timer $+ $read(timers.txt,%t) off
        $iif(%t = $lines(timers.txt), goto next, inc %t )
      }
      :next
      .remove timers.txt
      dialog -x group2
      tmrs
    }
  }
}
alias tmrs { 
  dialog $iif($dialog(group2), -v, -m) group2 group2
  did -r group2 1,2  
  var %i 1
  while (%i <= $var(%*,0)) {
    did -i group2 1 %i $var(%*,%i)
    inc %i
  }
  var %t 1 
  while (%t <= $timer(0)) {
    did -i group2 2 %t $timer(%t) 
    inc %t 
  }
}

Related Files

by Flobse
by Foreverurs
by Vulcan

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand