tglogo.png

Downloading File

Filename: Simple Timer(s) Dialog
dialog _Timer(s) {
  title ""
  size -1 -1 256 120
  option dbu
  box "Timer Info", 13, 2 51 252 40
  box "Timers", 2, 3 4 250 45
  list 1, 7 16 241 28, hsbar vsbar size
  text "Timer Name:", 3, 6 60 32 8
  edit "", 4, 37 59 25 10, read autohs
  text "Timer Action(s):", 5, 6 78 40 9
  edit "", 6, 224 59 25 10, read autohs
  text "Action(s) Time(s) Remaining:", 7, 64 60 70 8
  edit "", 8, 133 59 25 10, read autohs
  text "Delay Between Action(s):", 9, 161 60 62 8
  edit "", 10, 48 78 202 10, read autohs
  box "", 14, 3 73 252 1
  box "Options", 15, 2 92 252 26
  button "Halt Selected ", 17, 55 102 40 10
  button "Halt All ", 18, 162 102 31 10
  button "Clear Status", 16, 4 102 50 10
  button "Refresh", 20, 202 102 49 10
  box "", 21, 196 92 2 26
  box "", 11, 157 92 2 26
  button "Pause", 12, 96 102 29 10
  button "Resume", 19, 126 102 29 10
}

menu * {
  Timer Dialog: { _Timers_Inti }
}
alias _Timer_Tan_ {
  var %_TimerI 1
  while (%_TimerI <= 24) {
    dialog -t _Timer(s) $right(Timer(s) Info Dialog.���,%_TimerI)
    var %_TimerT 1
    while (%_TimerT <= 300) inc %_TimerT
    inc %_TimerI
  }
}
alias _Timers_Inti {
  if ($dialog(_Timer(s))) { dialog -x _Timer(s) _Timer(s) | dialog -m _Timer(s) _Timer(s) | _Timer_Tan_ }
  if (!$dialog(_Timer(s))) { dialog -m _Timer(s) _Timer(s) | _Timer_Tan_ }
}
alias _Timers_Inti2 { 
  .timers
  write -c _Timers_B.txt
  filter -cs _Timers_A.txt *Timer*
  _Timers_A
}
alias _Timers_A {
  unset %_TX1B
  var %_TX1 = 1
  while (%_TX1 <= $lines(_Timers_A.txt)) {
    var %_TX1A = $read(_Timers_A.txt,%_TX1)
    if (Active timers isin %_TX1A) { set %_TX1B %_TX1 }
    if (%_TX1 == $lines(_Timers_A.txt)) { _Timers_B }
    inc %_TX1 
  }
}

alias _Timers_B {
  var %_TX2 = 1
  while (%_TX2 <= $lines(_Timers_A.txt)) {
    var %_TX2A = $read(_Timers_A.txt,%_TX2)
    tokenize 32 $read(_Timers_A.txt,%_TX2)
    if ($5 != time(s)) { var %_TX2A1 * Timer $3-  }
    if ($5 == time(s)) { var %_TX2A1 * Timer $5-  }
    if (Timer isin %_TX2A) && (delay isin %_TX2A) && (%_TX2 >= %_TX1B) && (%_TX2A1 == $read(Timer_Paused.txt,w,%_TX2A1)) { did -a _Timer(s) 1 $read(_Timers_A.txt,%_TX2) (Paused) | write _Timers_B.txt $read(_Timers_A.txt,%_TX2) }
    if (Timer isin %_TX2A) && (delay isin %_TX2A) && (%_TX2 >= %_TX1B) && (%_TX2A1 != $read(Timer_Paused.txt,w,%_TX2A1)) { did -a _Timer(s) 1 $read(_Timers_A.txt,%_TX2) | write _Timers_B.txt $read(_Timers_A.txt,%_TX2) }
    if (%_TX2 == $lines(_Timers_A.txt)) && ($lines(_Timers_B.txt) == 0) { _Timer_None | halt }
    if (%_TX2 == $lines(_Timers_A.txt)) && ($lines(_Timers_B.txt) >= 1) { did -e _Timer(s) 18 | halt }
    inc %_TX2
  }
}

alias _Timers_C {
  var %_TX3 = 1
  while (%_TX3 <= $lines(_Timers_B.txt)) {
    if (%_TX3 == %_T_Sel) { 
      tokenize 32 $read(_Timers_B.txt,%_TX3)
      if (%_TX3 == %_T_Sel2) && (%_T_SelH == On) {  write -dl $+ %_T_Sel2 _Timers_B.txt | .timer $+ $3 off | set -u10 %_Timer_Sel_Halted $3 | did -b _Timer(s) 17 |  _Timer_Sel_Halted | did -d _Timer(s) 1 %_T_Sel2 | unset %_T_Sel2 %_T_SelH |  halt 
      }
      var %_TRS $chr(40) $+ $server $+ $chr(41)
      did -a _Timer(s) 4 $3  
      if ($5 != time(s)) { did -a  _Timer(s) 8 N/A/0 | did -a  _Timer(s) 6 $4 | did -a _Timer(s) 10 $remove($6-,%_TRS)) | halt }
      did -a _Timer(s) 8 $4  
      did -a _Timer(s) 6 $6
      did -a _Timer(s) 10 $remove($8-,%_TRS))
    }
    inc %_TX3
  }
}

on *:dialog:_Timer(s):init:*: {
  did -b _Timer(s) 17,18,12,19 
  _Timers_Inti2
}

on *:dialog:_Timer(s):sclick:*: {
  if ($did == 1) { 
    set %_SelS $did(1).seltext
    var %_Sel_Num_TS $numtok(%_SelS,32))
    var %_Sel_Num_TS2 $gettok(%_SelS,%_Sel_Num_TS,32))
    var %_PausedS $chr(40) $+ Paused $+ $chr(41)
    if (%_Sel_Num_TS2 == %_PausedS) { did -e $dname 17,18,19 | did -b $dname 12 | set %_T_Sel $did(1).sel | did -r $dname 4,6,8,10 | _Timers_C | halt }
    if (%_Sel_Num_TS2 != %_PausedS) { did -e $dname 17,12 | did -b $dname 19 | set %_T_Sel $did(1).sel | did -r $dname 4,6,8,10 | _Timers_C | halt }
  }
  if ($did == 16) { clear -s | _Timer_Status }
  if ($did == 17) { 
    set %_SH $did(1).sel
    set %_SelH $did(1).seltext
    var %_Sel_Num_R1 $numtok(%_SelH,32))
    var %_Sel_Num_R2 $gettok(%_SelH,%_Sel_Num_RH,32))
    var %_Sel_Num_R3 $gettok(%_SelH, $+ $calc(%_Sel_Num_R2 - 1) $+ ,32))
    did -d $dname 1 %_SH 
    tokenize 32 %_SelH
    if ($5 != time(s)) { 
      if ($did(1).lines == 0) { did -r $dname 4,6,8,10 | did -b _Timer(s) 17,18,12,19 }
    set -u20 %_HH On | set %_Timer_Rem_Sel * Timer $remove($3-,%_Sel_Num_R3) | .Timer $+ $3 Off | set %_T_Sel2 $did(1).sel | did -r $dname 4,6,8,10 | set %_T_SelH On | did -d $dname 1 %_PR | _Timers_Removed | set %_Timer_Sel_Halted $3 | _Timer_Sel_Halted | halt }
    .timer $+ $3 off
    set %_Timer_Rem_Sel * Timer $remove($5-,%_Sel_Num_R3) 
    set %_Timer_Sel_Halted $3 | _Timer_Sel_Halted
    if ($did(1).lines == 0) { did -r $dname 4,6,8,10 | did -b _Timer(s) 17,18,12,19 }
    set %_T_Sel2 $did(1).sel | did -r $dname 4,6,8,10 | set -u1 %_HH On | _Timers_Removed 
  }
  if ($did == 18) { .timers off | did -r $dname 4,6,8,10,1 | did -b $dname 17,18 | write -c Timer_Paused.txt | _Timer_All_Off } 
  if ($did == 20) { _Timers_Inti }
  if ($did == 12) {
    set %_PP $did(1).sel
    set %_Timer_Paused $did(1).seltext 
    tokenize 32 $did(1).seltext 
    var %_TPS $chr(40) $+ $server $+ $chr(41)
    set %_Timer_Paused2 $3
    did -b $dname 12
    if ($5 != time(s)) { .timer $+ $3 -p 0 $remove($4,s,m) $remove($6-,%_TPS)) | write Timer_Paused.txt * Timer $3- | did -o $dname 1 %_PP %_Timer_Paused (Paused) | did -b $dname 19,17 | _Timer_Sel_Paused | halt }
    .timer $+ $3 -p $4 $remove($6,s,m) $remove($8-,%_TPS))
    write Timer_Paused.txt * Timer $5-
    did -o $dname 1 %_PP %_Timer_Paused (Paused)
    did -b $dname 19,17
    _Timer_Sel_Paused
  }
  if ($did == 19) { 
    set %_SelP $did(1).seltext
    var %_Sel_Num_R1 $numtok(%_SelP,32))
    var %_Sel_Num_R2 $gettok(%_SelP,%_Sel_Num_R1,32))
    var %_Sel_Num_R3 $gettok(%_SelP, $+ $calc(%_Sel_Num_R1 - 1) $+ ,32))
    var %_Paused $chr(40) $+ Paused $+ $chr(41)
    if (%_Sel_Num_R2 == %_Paused) {
      set %_PR $did(1).sel
      set %_Timer_Resumed $did(1).seltext 
      tokenize 32 $did(1).seltext 
      var %_TRS $chr(40) $+ $server $+ $chr(41)
      set %_Timer_Resumed2 $3
      if ($5 != time(s)) { set %_Timer_Rem_Sel * Timer $remove($3-,%_Sel_Num_R2) | .timer $+ $3 -r 0 $remove($4,s,m) $remove($6-,%_Sel_Num_R2,%_Sel_Num_R3)) | did -o $dname 1 %_PR $remove(%_Timer_Resumed,%_Sel_Num_R2)) | set %_Timer_Resumed2 $3 | _Timers_Removed | did -b $dname 19,17 | halt }
      .timer $+ $3 -r $4 $remove($6,s,m) $remove($8-,%_Sel_Num_R2,%_Sel_Num_R3))
      set %_Timer_Rem_Sel * Timer $remove($5-,%_Sel_Num_R2)
      set %_Timer_Resumed2 $3
      did -o $dname 1 %_PR $remove(%_Timer_Resumed,%_Sel_Num_R2))
      did -b $dname 19,17
      _Timers_Removed
    }
  }
}

alias _Timers_Removed {
  var %_TRX = 1
  while (%_TRX <= $lines(Timer_Paused.txt)) {
    set %_TRXA $read(Timer_Paused.txt,%_TRX)
    if (%_TRXA == %_Timer_Rem_Sel) && (%_HH == On) { write -dl $+ %_TRX Timer_Paused.txt | halt }
    if (%_TRXA == %_Timer_Rem_Sel) { write -dl $+ %_TRX Timer_Paused.txt | _Timer_Sel_Resumed }
    inc %_TRX
  }
}

alias _Timer_Sel_Resumed {
  if ($version < 6.31) { echo -a ( 4TIMER(S) Tip Notice: $+ $me $+  timer 4" $+ %_Timer_Resumed2 $+ " has resumed. )  
  }
  else {
    $tip(4TIMER(S),4TIMER(S), $+ $me $+  timer 4" $+ %_Timer_Resumed2 $+ " resumed., 3) 
  }
}

alias _Timer_Sel_Paused {
  if ($version < 6.31) { echo -a ( 4TIMER(S) Tip Notice: $+ $me $+  timer 4" $+ %_Timer_Paused2 $+ " has been paused. )  
  }
  else {
    $tip(4TIMER(S),4TIMER(S), $+ $me $+  timer 4" $+ %_Timer_Paused2 $+ " has been paused., 3) 
  }
}
alias _Timer_Sel_Halted {
  if ($version < 6.31) { echo -a ( 4TIMER(S) Tip Notice: $+ $me $+  timer 4" $+ %_Timer_Sel_Halted $+ " has been halted. )  
  }
  else {
    $tip(4TIMER(S),4TIMER(S), $+ $me $+  timer 4" $+ %_Timer_Sel_Halted $+ " has been halted., 3) 
  }
}

alias _Timer_Status {
  if ($version < 6.31) { echo -a ( 4TIMER(S) Tip Notice: $+ $me $+  status window is now 4CLEAR.This allows the timer(s) data be collected faster. )  
  }
  else {
    $tip(4TIMER(S),4TIMER(S), $+ $me $+  status window is now 4CLEAR.This allows the timer(s) data be collected faster., 3) 
  }
}

alias _Timer_None {
  if ($version < 6.31) { echo -a ( 4TIMER(S) Tip Notice: $+ $me $+  there are no 4ACTIVE timers. )  
  }
  else {
    $tip(4TIMER(S),4TIMER(S), $+ $me $+  there are no 4ACTIVE Timers., 3) 
  }
}
alias _Timer_ALL_Off {
  if ($version < 6.31) { echo -a ( 4TIMER(S) Tip Notice: $+ $me $+  all 4ACTIVE timers are now halted. )  
  }
  else {
    $tip(4TIMER(S),4TIMER(S), $+ $me $+  all 4ACTIVE timers are now halted., 3) 
  }
}
raw 421:*: { if ($2 == 1) { halt } }

Related Files


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