WinampSYS
Posted by Coag
Monday, January 23, 2006
Description: A winamp control dialog with sleep timer and alarm capabilities

Enjoy.


dialog wsys {
  title "Winamp System"
  size -1 -1 86 106
  option dbu
  tab "Sleep Timer", 1, 1 -2 83 106
  box "Information", 3, 2 16 79 34, tab 1
  button "Set It!", 4, 30 33 47 13, tab 1
  text "Time: ( #M, #S, or #H )", 5, 10 23 59 8, tab 1
  edit "", 6, 3 33 23 13, tab 1
  tab "Alarm Timer", 2
  box "Information", 16, 2 16 79 34, tab 2
  text "Time: ( #M, #S, or #H )", 17, 10 23 59 8, tab 2
  edit "", 18, 3 33 23 13, tab 2
  button "Set It!", 19, 30 33 47 13, tab 2
  box "Controls", 7, 2 54 79 49
  button "||", 12, 20 62 13 12, flat
  button "<<", 10, 5 76 13 12, flat
  button ">", 8, 20 76 13 12, flat
  button ">>", 9, 35 76 13 12, flat
  button "", 11, 20 89 13 12, flat
  button "+", 13, 63 61 13 12, flat
  button "X", 15, 63 74 13 13, flat
  button "-", 14, 63 88 13 12, flat
}

alias winampsys { if (!$dialog(wsys)) dialog -md wsys wsys }

on *:DIALOG:wsys:sclick:*:{
  if ($did == 8) { ;Play button
    .dde mplug control play
  }
  elseif ($did == 9) { ;Next button
    .dde mplug control >
  }
  elseif ($did == 10) { ;Previous button
    .dde mplug control <
  }
  elseif ($did == 11) { ;Stop button
    .dde mplug control stop
  }
  elseif ($did == 12) { ;Pause button
    .dde mplug control pause
  }
  elseif ($did == 13) { ;VolumeUp button
    .dde mplug control vup
  }
  elseif ($did == 14) { ;VolumeDown button
    .dde mplug control vdwn
  }
  elseif ($did == 15) { ;Mute Button
    if (!%wsys.muted) { set %wsys.muted 1 | set %wsys.vol $dde(mplug,var_vol) | .dde mplug control vol 0 }
    else { unset %wsys.muted | .dde mplug control vol %wsys.vol | unset %wsys.vol }
  }
  elseif ($did == 4) { ;Set It! button for SleepTimer.
    if (($did($dname,6)) && ($right($did($dname,6),1) isalpha) && ($left($did($dname,6),$calc($len($did($dname,6))-1)) isnum)) {

      if ($right($did($dname,6),1) == H) { ;Hours
        .timerWSYSSLEEP $+ $rand(1,100) 1 $calc($calc($left($did($dname,6),$calc($len($did($dname,6))-1)) * 60) * 60) .dde mplug control stop
        did -r $dname 6
      }

      elseif ($right($did($dname,6),1) == M) { ;Minutes
        .timerWSYSSLEEP $+ $rand(1,100) 1 $calc($left($did($dname,6),$calc($len($did($dname,6))-1)) * 60) .dde mplug control stop
        did -r $dname 6
      }

      elseif ($right($did($dname,6),1) == S) { ;Seconds
        .timerWSYSSLEEP $+ $rand(1,100) 1 $left($did($dname,6),$calc($len($did($dname,6))-1)) .dde mplug control stop
        did -r $dname 6
      }

    }
  }
  elseif ($did == 19) { ;Set It! button for AlarmTimer.
    if (($did($dname,18)) && ($right($did($dname,18),1) isalpha) && ($left($did($dname,18),$calc($len($did($dname,18))-1)) isnum)) {

      if ($right($did($dname,18),1) == H) { ;Hours
        .timerWSYSALARM $+ $rand(1,100) 1 $calc($calc($left($did($dname,18),$calc($len($did($dname,18))-1)) * 60) * 60) .dde mplug control stop
        did -r $dname 18
      }

      elseif ($right($did($dname,18),1) == M) { ;Minutes
        .timerWSYSALARM $+ $rand(1,100) 1 $calc($left($did($dname,18),$calc($len($did($dname,18))-1)) * 60) .dde mplug control stop
        did -r $dname 18
      }

      elseif ($right($did($dname,18),1) == S) { ;Seconds
        .timerWSYSALARM $+ $rand(1,100) 1 $left($did($dname,18),$calc($len($did($dname,18))-1)) .dde mplug control stop
        did -r $dname 18
      }
    }
  }
}
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world