[script]
n0=dialog reveil {
n1=  size -1 -1 150 150
n2=  title "Réveil silencieux"
n3=  button "Ok",1,45 110 60 20,ok
n4=  box "A quelle heure ?",2,5 5 140 50
n5=  edit "",3,12 25 30 20
n6=  text " H",4,45 28 20 18
n7=  edit "",5,65 25 30 20
n8=  text " Minutes",6,98 28 45 18
n9=  box "Status",11,5 58 140 40
n10=  check "Activer le réveil",12,24 75 90 15
n11=}
n12=on *:dialog:reveil:sclick:12:{ 
n13=  if $did($dname,12).state == 1 && $readini config.ini config+ reveil_time != off { writeini config.ini config+ reveil_status on | active_reveil }
n14=  else { did -u $dname $did | writeini config.ini config+ reveil_status off | desactive_reveil }
n15=}
n16=alias active_reveil {
n17=  if $readini config.ini config+ reveil_status != off  && $readini config.ini config+ reveil_time != off {
n18=    var %t = $readini config.ini config+ reveil_time 
n19=    .timerreveil [ %t ] 1 1 is_time_reveil
n20=  }
n21=}
n22=
n23=alias desactive_reveil { .timerreveil off }
n24=on *:dialog:reveil:sclick:10:{ .timer 1 0 sound_reveil }
n25=on *:dialog:reveil:sclick:9:{ writeini config.ini config+ reveil_mode sound }
n26=on *:dialog:reveil:init:0:{
n27=  if $readini config.ini config+ reveil_status == on  { did -c $dname 12 }
n28=  if $readini config.ini config+ reveil_time != off {
n29=    var %t = $ifmatch
n30=    did -a $dname 3 $gettok(%t,1,58)
n31=    did -a $dname 5 $gettok(%t,2,58)
n32=  }
n33=}
n34=
n35=on *:dialog:reveil:edit:*:{
n36=  if $did($dname,3).text isnum 0-23 { var %h = $did($dname,3).text }
n37=  else { writeini config.ini config+ reveil_time off  | .timerreveil off | return }
n38=  if $did($dname,5).text isnum 0-59 { var %m = $did($dname,5).text }
n39=  else { writeini config.ini config+ reveil_time off  | .timerreveil off | return }
n40=  writeini config.ini config+ reveil_time %h $+ $chr(58) $+ %m 
n41=  active_reveil
n42=}
n43=alias revconf { if $dialog(reveil) == $null { dialog -m reveil reveil } }
n44=
n45=alias is_time_reveil {
n46=  msg $me C L' heureeeeeeeee !!!!! il est $time(HH:nn)
n47=  /write config.ini config+ reveil_status == off
n48=}
n49=menu @reveil {
n50=  close:{
n51=    window -c $active
n52=  }
