somdcomputerguy Posted March 6, 2011 Posted March 6, 2011 (edited) This script is basically just two timers, after one it stops Winamp's playback, after the other it starts Winamp's playback. So the GUI has three tabs, Lullaby - a 'countdown' type of timer, Wakeup - an 'alarmclock' type of timer, and the third tab, Info, which has a incomplete progress bar. This progress bar was in an earlier version of this script, turned into non graphical data on a new Info tab, and then birthed a progess bar onto this tab, and it only works right now for 3/4 of the Lullaby countdown. This script is always under development (read: always getting closer to working right all the time..), but for the most part this version works, and while the code may be sloppy and not commented well, I hope that this code is useful to someone here. Useful as an actual program, useful codewise as a tutorial or something, or whatever. This script now has it's own webpage! I put a compiled script on somebody else's Win7 PC to see if it worked. It did, he liked it, so I left it on there for him to use. A friend of his saw it, so he called me and asked if he could email it to someone else. I said sure. So I know that there's at least two other people that find use for this. So I thought this script deserved a webpage. I don't pay myself well enough to make this script into the next 'killer app' or turn the webpage into some kind of awesome shrine or something, but this script (and now the webpage) will slowly get better and better. Remember, slowly. S - L - O...If this code raises any questions, I'll do my best to answer them or defend myself. If anybody actually uses this, I would be happy to receive some feedback/suggestions.The 'Wakeup' part works only with Winamp. The Lullaby part will shutdown the PC or close another window as well as the Winamp stuff.<br><br>#include <Misc.au3><br><br>Sleep(250)<br><br>If _Singleton("X-Lorem Ipsum",1) = 0 Then<br> Msgbox(0,"Warning","An occurence of X-Lorem Ipsum is already running", 3)<br> Exit<br>EndIf<br><br>#include <File.au3><br>#include <Date.au3><br>#include <String.au3><br>#include <GuiTab.au3><br>#include <Constants.au3><br>#include <EditConstants.au3><br>#include <Winamp_Library.au3> ; http://www.autoitscript.com/forum/topic/71187-winamp-library-on-pure-autoit/<br>#include <GUIConstantsEx.au3><br>#include <ComboConstants.au3><br>#include <SliderConstants.au3><br>#include <ButtonConstants.au3><br>#include <WindowsConstants.au3><br>#include <ProgressConstants.au3><br>#include <DateTimeConstants.au3><br><br>#Region ### START Opts and Declarations section ###<br>Opt("TrayMenuMode", 3)<br>Opt("SendKeyDelay", 150)<br>;Opt("TrayIconDebug", 1)<br>Opt("MouseCoordMode", 2)<br>Opt("GUIOnEventMode", 1)<br>Opt("TrayOnEventMode", 1)<br>Opt("MustDeclareVars", 1)<br>Opt("WinTitleMatchMode", 2)<br><br>Local $TrayToggleHide, $TrayRestart, $TrayExit, $TrayToggleHotKey<br>Local $Form, $Tab, $Tab0, $Tab1, $Tab2, $Tab2_Label1, $Tab2_Label2, $Tab2_Label3, $Tab2_Label4, $Tab2_Label5, $Tab2_Label6, $Tab2_Label7, $Tab2_Label8<br>Global $Input_PlaylistorFile, $Input_Snooze, $Input_Time, $Input_Title<br>Global $Combo_WinAmpStop, $Combo_Shutdown, $Combo_TimeFrame, $Combo_WinAmpStart<br>Global $Slider_Fadein_Time, $Slider_Fadein_Time_Value, $Old_Slider1_Value, $Slider_MaxVol, $Slider_MaxVol_Value, $Old_Slider2_Value<br>Global $Button_Begin, $Button_GetTitle, $Button_Pick, $Button_Random, $Progressbar<br>Global $Countdown, $CountdownTotal, $CountdownToDate, $CurrentVolume, $MaxVolume<br>Global $SelectedSong, $FadeTime, $CountdownTime, $Input_AlarmTime, $AlarmTimeData, $FileList, $RandomFile, $Folder<br>Global $IniFile = @ScriptDir & "\X-Lorem.ini"<br>Global $RndORSel, $MusicPath, $Restart, $MouPos, $HotKeyAble = 1, $Checkbox_Fade<br>#EndRegion ### END Opts and Declarations section ###<br><br>#Region ### START HotKeySet and INI section ###<br>HotKeySet("{F2}", "VolUpDownMute") ;ToggleMute<br>HotKeySet("{F3}", "VolUpDownMute") ;VolDown<br>HotKeySet("{F4}", "VolUpDownMute") ;VolUp<br>HotKeySet("{F10}", "ToggleHide")<br><br>$AlarmTimeData = IniRead($IniFile, "Alarm Time", "AlarmTime", @HOUR & ":" & @MIN)<br>$MouPos = StringSplit(IniRead($IniFile, "XLorem Position", "XPos", 10 & "," & 535), ",")<br>#EndRegion ### END HotKeySet and INI section section ###<br><br>#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\koda\Forms\LoremIpsum.kxf<br><br>If $MouPos[0] & ", " & $MouPos[1] <> "15, " & @DesktopHeight - 275 And StringIsDigit($MouPos[0]) And StringIsDigit($MouPos[1]) Then<br> $Form = GUICreate("X-Lorem Ipsum", 450, 200, $MouPos[1], $MouPos[2], Default, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)<br>Else<br> $Form = GUICreate("X-Lorem Ipsum", 450, 200, 15, @DesktopHeight - 275, Default, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)<br>EndIf<br> GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")<br> GUISetIcon("1998_low_cost_clock.ico")<br> GUISetBkColor(0xc0c0c0)<br>$Tab = GUICtrlCreateTab(-1, -1, 450, 200)<br> GUICtrlSetResizing($Tab, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)<br>;<br>$Tab0 = GUICtrlCreateTabItem("Lullaby")<br>$Combo_WinAmpStop = GUICtrlCreateCombo(" WinAmp ", 15, 40, 115, 20)<br> GUICtrlSetData($Combo_WinAmpStop, " Just Stop | Stop-n-Play | Stop When Done | End Program ")<br> GUICtrlSetTip($Combo_WinAmpStop, " Just Stop " & @LF & " Stop-n-Play - Stop playing, go right to Wakeup " & @LF & " Stop When Done - Stop after the current song ends " & @LF & " End Program ", " How To Stop Winamp.. ", 1)<br> GUICtrlSetOnEvent($Combo_WinAmpStop, "CheckWinampStop")<br>$Combo_TimeFrame = GUICtrlCreateCombo(" Lullaby Time ", 170, 40, 115, 20)<br> GUICtrlSetData($Combo_TimeFrame, " Specific Time | Hour.Hour | Hour,Minute | Minute ")<br> GUICtrlSetOnEvent($Combo_TimeFrame, "CheckTimeCombo")<br> GUICtrlSetTip($Combo_TimeFrame, " Specific Time - 4:20 " & @LF & " Hour.Hour - 2.5 - 2 hours 30 minutes " & @LF & " Hour,Minute - 2,30 - 2 hours 30 minutes " & @LF & " Minute - 150 - 2 hours 30 minutes ", " Lullaby Time ", 1)<br>$Input_Time = GUICtrlCreateInput("", 340, 40, 65, 25, $ES_CENTER)<br> GUICtrlSetState($Input_Time, $GUI_DISABLE)<br>$Combo_Shutdown = GUICtrlCreateCombo(" Shutdown Options ", 100, 75, 200, 20)<br> GUICtrlSetData($Combo_Shutdown, " Lock | Standby | Hibernate | Reboot | Shutdown")<br> GUICtrlSetTip($Combo_Shutdown, " Lock " & @LF & " Standby " & @LF & " Hibernate " & @LF & " Reboot " & @LF & " Shutdown ", " Shutdown Options ", 1)<br>$Input_Title = GUICtrlCreateInput("Close Title", 100, 115, 250, 25, $ES_CENTER)<br> GUICtrlSetState($Input_Title, $GUI_DISABLE)<br>$Button_GetTitle = GUICtrlCreateButton("Title", 20, 115, 60, 25)<br> GUICtrlSetOnEvent($Button_GetTitle, "GetTitle")<br>$Button_Begin = GUICtrlCreateButton("Begin", 170, 160, 100, 25)<br> GUICtrlSetOnEvent($Button_Begin, "Lullaby")<br>$Checkbox_Fade = GUICtrlCreateCheckbox("Fade", 90, 160, 60, 20)<br>;<br>$Tab1 = GUICtrlCreateTabItem("Wakeup")<br>$Combo_WinAmpStart = GUICtrlCreateCombo(" WinAmp ", 190, 35, 115, 20)<br> GUICtrlSetData($Combo_WinAmpStart, " Start Playing | Select | Random ")<br> GUICtrlSetOnEvent($Combo_WinAmpStart, "CheckStartCombo")<br>#cs<br>$Checkbox_Winamp_Wakeup = GUICtrlCreateCheckbox("Winamp", 190, 35, 85, 20)<br> GUICtrlSetOnEvent($Checkbox_Winamp_Wakeup, "Highlander")<br>$Checkbox_Direct = GUICtrlCreateCheckbox(" Direct", 190, 55, 85, 20)<br> GUICtrlSetOnEvent($Checkbox_Direct, "Highlander")<br>$Button_Pick = GUICtrlCreateButton("Pick", 298, 30, 40, 20)<br> GUICtrlSetOnEvent($Button_Pick, "PickMusic")<br>$Button_Random = GUICtrlCreateButton("Random", 285, 60, 65, 20)<br> GUICtrlSetOnEvent($Button_Random, "RndMusic")<br>#ce<br>$Button_Begin = GUICtrlCreateButton("Begin", 170, 160, 100, 25)<br> GUICtrlSetOnEvent($Button_Begin, "Lullaby")<br>$Input_AlarmTime = GUICtrlCreateInput($AlarmTimeData, 158, 125, 65, 25, $ES_CENTER)<br> GUICtrlSetState($Input_AlarmTime, $GUI_DISABLE)<br> GUICtrlSetOnEvent($Input_AlarmTime, "WriteAlarmTime")<br> GUICtrlCreateLabel("Wakeup", 100, 126)<br>$Input_PlaylistorFile = GUICtrlCreateInput("Playlist or File", 85, 90, 275, 25, $ES_CENTER)<br> GUICtrlSetState($Input_PlaylistorFile, $GUI_DISABLE)<br>$Input_Snooze = GUICtrlCreateInput(IniRead($IniFile, "Snooze Time", "SnoozeTime", 9), 285, 125, 25, 25, $ES_CENTER)<br> GUICtrlSetState($Input_Snooze, $GUI_DISABLE)<br> GUICtrlSetOnEvent($Input_Snooze, "WriteSnoozeTime")<br> GUICtrlCreateLabel("Snooze", 230, 126)<br> GUICtrlCreateLabel("Minute(s)", 315, 126)<br>$Slider_Fadein_Time = GUICtrlCreateSlider(10, 55, 15, 85, $TBS_VERT)<br> GUICtrlCreateLabel("Fade In Time", 10, 35)<br> GUICtrlSetOnEvent($Slider_Fadein_Time, "Update_FadeInTime")<br> GUICtrlSetLimit($Slider_Fadein_Time, 20, 0)<br> GUICtrlSetData($Slider_Fadein_Time, IniRead($IniFile, "Levels", "FadeInTime", 5))<br>$Slider_Fadein_Time_Value = GUICtrlCreateLabel(GUICtrlRead($Slider_Fadein_Time), 135, 35)<br>$Slider_MaxVol = GUICtrlCreateSlider(40, 80, 15, 85, $TBS_VERT)<br> GUICtrlCreateLabel("Max Volume", 40, 60)<br> GUICtrlSetOnEvent($Slider_MaxVol, "Update_MaxVolume")<br> GUICtrlSetLimit($Slider_MaxVol, 100, 0)<br> GUICtrlSetData($Slider_MaxVol, IniRead($IniFile, "Levels", "MaxVolume", 85))<br>$Slider_MaxVol_Value = GUICtrlCreateLabel(GUICtrlRead($Slider_MaxVol), 145, 60)<br>$Checkbox_Fade = GUICtrlCreateCheckbox("Fade", 90, 160, 60, 20)<br>;<br>$Tab2 = GUICtrlCreateTabItem("Info")<br>;$Tab2_Label1 = GUICtrlCreateLabel("[Ctrl+Alt]+ESC - Quit", 10, 25)<br>$Tab2_Label3 = GUICtrlCreateLabel("SPACE - 1x -> Snooze 2x -> Restart" & @LF & @LF & "F2/F3/F4 - Volume Mute/Down/Up" & @LF & "F10 - Window Show/Hide", 10, 95)<br>;$Tab2_Label2 = GUICtrlCreateLabel("F2/F3/F4 - Volume Mute/Down/Up", 10, 73)<br>;$Tab2_Label4 = GUICtrlCreateLabel("F10 - Window Show/Hide", 10, 93)<br>$Tab2_Label5 = GUICtrlCreateLabel("Text", 10, 35, 500)<br>;$Tab2_Label6 = GUICtrlCreateLabel("Hr.Hr (1.5 = 1 Hour and 30 Minutes)" & @LF & "Hr,Min (1,5 = 1 Hour and 5 Minutes)", 10, 130)<br>$Tab2_Label7 = GUICtrlCreateLabel(" >- Enabled", 242, 135)<br>$Tab2_Label8 = GUICtrlCreateLabel(" - Not Enabled", 245, 95)<br>$Progressbar = GUICtrlCreateProgress(50, 60, 335, 22, -1, $PBS_SMOOTH)<br> GUICtrlSetColor($Progressbar, 0x00ff00)<br>;<br>GUICtrlCreateTabItem("")<br>GUISetState(@SW_SHOW)<br>#EndRegion ### END Koda GUI section ###<br><br>#Region ### START Tray section ###<br>$TrayToggleHide = TrayCreateItem("Show/Hide")<br> TrayItemSetOnEvent(-1, "ToggleHide")<br>$TrayToggleHotKey = TrayCreateItem("Disable Hotkeys")<br> TrayItemSetOnEvent(-1, "ToggleHotKey")<br>$TrayRestart = TrayCreateItem("Restart")<br> TrayItemSetOnEvent(-1, "Restart")<br>$TrayExit = TrayCreateItem("Exit")<br> TrayItemSetOnEvent(-1, "Quit")<br>;<br>TraySetState()<br>TraySetClick(9)<br>TraySetIcon(@ScriptDir & "\1998_low_cost_clock.ico")<br>TraySetToolTip("X-Lorem Ipsum - Click here for the menu..")<br>TraySetOnEvent($TRAY_EVENT_MOUSEOVER,"MouseOverTray")<br>#EndRegion ### END Tray section ###<br><br>While 1<br> Sleep(100)<br>WEnd<br><br>Func Lullaby()<br> If GUICtrlRead($Combo_WinAmpStop) = " Stop-n-Play " And GUICtrlRead($Combo_WinAmpStart) = " WinAmp " Then<br> MsgBox(0, "", "You must select a startup thing too you know..")<br> Restart()<br> EndIf<br> ControlClick("X-Lorem Ipsum", "", "SysTabControl321", "left", 1, 135, 10)<br> If GUICtrlRead($Checkbox_Fade) = $GUI_CHECKED Then<br> For $iTransValue = 250 To 5 Step -15<br> WinSetTrans("X-Lorem Ipsum", "", $iTransValue)<br> Sleep(10)<br> Next<br> WinSetState("X-Lorem Ipsum", "", @SW_HIDE)<br> WinSetTrans("X-Lorem Ipsum", "", 255)<br> EndIf<br> Local $TimeFraction, $ConvertedHour, $ConvertedMinutes, $Timesplit<br> If GUICtrlRead($Combo_TimeFrame) <> " Lullaby Time " Then<br> Switch GUICtrlRead($Combo_TimeFrame)<br> Case " Hour.Hour "<br> If StringInStr(GUICtrlRead($Input_Time), ".") Then<br> $TimeFraction = StringSplit(GUICtrlRead($Input_Time), ".")<br> $CountdownToDate = _DateAdd('n', (60 * $TimeFraction[1]) + ((60 * $TimeFraction[2]) / 10), _NowCalc())<br> GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour.Hour - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3))<br> ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour.Hour" & @LF & "$TimeFraction[1] - " & $TimeFraction[1] & @LF & "$TimeFraction[2] - " & $TimeFraction[2] & @LF & $CountdownToDate & @LF)<br> Else<br> $CountdownToDate = _DateAdd('h', GUICtrlRead($Input_Time), _NowCalc())<br> GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour.Hour - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3))<br> ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & @LF & $CountdownToDate & @LF)<br> EndIf<br> Case " Hour,Minute "<br> If StringInStr(GUICtrlRead($Input_Time), ",") Then<br> $TimeFraction = StringSplit(GUICtrlRead($Input_Time), ",")<br> $CountdownToDate = _DateAdd('n', (60 * $TimeFraction[1]) + $TimeFraction[2], _NowCalc())<br> GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour,Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3))<br> ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour,Minute" & @LF & "$TimeFraction[1] - " & $TimeFraction[1] & @LF & "$TimeFraction[2] - " & $TimeFraction[2] & @LF & $CountdownToDate & @LF)<br> Else<br> $CountdownToDate = _DateAdd('h', GUICtrlRead($Input_Time), _NowCalc())<br> GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour,Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3))<br> ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & @LF & $CountdownToDate & @LF)<br> EndIf<br> Case " Minute "<br> If StringInStr(GUICtrlRead($Input_Time), ".") Then<br> $TimeFraction = StringSplit(GUICtrlRead($Input_Time), ".")<br> $CountdownToDate = _DateAdd('s', (60 * $TimeFraction[1]) + ((60 * $TimeFraction[2]) / 10), _NowCalc())<br> GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3))<br> ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & " Minute" & @LF & "$TimeFraction[1] - " & $TimeFraction[1] & @LF & "$TimeFraction[2] - " & $TimeFraction[2] & @LF & $CountdownToDate & @LF)<br> Else<br> $CountdownToDate = _DateAdd('n', GUICtrlRead($Input_Time), _NowCalc())<br> GUICtrlSetData($Tab2_Label5, _NowCalc() & " - " & GUICtrlRead($Input_Time) & " Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3))<br> ;MsgBox(0, "", _NowCalc() & @LF & GUICtrlRead($Input_Time) & @LF & $CountdownToDate & @LF)<br> EndIf<br> Case " Specific Time "<br> $Timesplit = StringSplit(Number(StringFormat("%04d",StringRegExpReplace(GUICtrlRead($Input_Time), "\D", ""))), "")<br> If StringInStr(GUICtrlRead($Input_Time), "p") Then<br> Switch $Timesplit[0]<br> Case 3<br> $ConvertedHour = $Timesplit[1] + 12<br> $ConvertedMinutes = $Timesplit[2] & $Timesplit[3]<br> If $ConvertedHour = 24 Then $ConvertedHour = 00<br> GUICtrlSetData($Tab2_Label5, "Lullaby Switch 3a, Waiting till " & $ConvertedHour & $ConvertedMinutes)<br> Case 4<br> If ($Timesplit[1] & $Timesplit[2]) = 12 Then<br> $ConvertedHour = $Timesplit[1] & $Timesplit[2]<br> Else<br> $ConvertedHour = ($Timesplit[1] & $Timesplit[2]) + 12<br> EndIf<br> $ConvertedMinutes = $Timesplit[3] & $Timesplit[4]<br> If $ConvertedHour = 24 Then $ConvertedHour = 00<br> GUICtrlSetData($Tab2_Label5, "Lullaby Switch 4a, Waiting till " & $ConvertedHour & $ConvertedMinutes)<br> EndSwitch<br> Else<br> Switch $Timesplit[0]<br> Case 3<br> $ConvertedHour = $Timesplit[1]<br> $ConvertedMinutes = $Timesplit[2] & $Timesplit[3]<br> GUICtrlSetData($Tab2_Label5, "Lullaby Switch 3b, Waiting till " & $ConvertedHour & $ConvertedMinutes)<br> Case 4<br> If ($Timesplit[1] & $Timesplit[2]) = 12 Then<br> $ConvertedHour = 0<br> Else<br> $ConvertedHour = $Timesplit[1] & $Timesplit[2]<br> EndIf<br> $ConvertedMinutes = $Timesplit[3] & $Timesplit[4]<br> GUICtrlSetData($Tab2_Label5, "Lullaby Switch 4b, Waiting till " & $ConvertedHour & $ConvertedMinutes)<br> EndSwitch<br> EndIf<br> Do<br> Sleep(100)<br> Until $ConvertedHour & $ConvertedMinutes = @Hour & @Min<br> #cs<br> Do<br> Sleep(10)<br> Until Number(StringFormat("%04d",StringRegExpReplace(GUICtrlRead($Input_Time), "\D", ""))) = Number(@Hour & @Min) ;http://www.autoitscript.com/forum/topic/123103-how-to-check-systemtime/page__view__findpost__p__855050<br> #ce<br> EndSwitch<br> If GUICtrlRead($Combo_TimeFrame) <> " Specific Time " Then<br> Local $DateDiffCalc = _DateDiff( 'n', _NowCalc(), $CountdownToDate)<br> Local $TotalDateDiffCalc = $DateDiffCalc<br> GUICtrlSetData($Progressbar, ($DateDiffCalc / $TotalDateDiffCalc) * 100)<br> Do<br> $DateDiffCalc = _DateDiff( 'n', _NowCalc(), $CountdownToDate)<br> If $DateDiffCalc <> $TotalDateDiffCalc Then GUICtrlSetData($Progressbar, ($DateDiffCalc / $TotalDateDiffCalc) * 100)<br> Sleep(10)<br> ;Until Number(StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) = @HOUR & ":" & @MIN<br> Until $CountdownToDate <= _NowCalc()<br> GUICtrlSetData($Progressbar, 0)<br> EndIf<br> EndIf<br> RunAfterLullaby()<br>EndFunc ;==>Lullaby<br><br>Func RunAfterLullaby()<br> GUICtrlSetData($Tab2_Label5, "NightNight..")<br> If GUICtrlRead($Combo_WinAmpStop) <> " WinAmp " Then<br> Switch GUICtrlRead($Combo_WinAmpStop)<br> Case " Just Stop "<br> _Winamp_Stop()<br> Case " Stop-n-Play "<br> WakeupNow()<br> Case " Stop When Done "<br> ControlSend("Winamp", "", "", "^v")<br> Case " End Program "<br> _Winamp_Close()<br> EndSwitch<br> EndIf<br> If GUICtrlRead($Input_Title) <> "Close Title" Then WinClose(GUICtrlRead($Input_Title))<br> If GUICtrlRead($Combo_Shutdown) <> " Shutdown Options " Then<br> Switch GUICtrlRead($Combo_Shutdown)<br> Case " Lock "<br> Run("rundll32.exe user32.dll, LockWorkStation")<br> Case " Standby "<br> Shutdown(32)<br> Case " Hibernate "<br> Shutdown(64)<br> Case " Reboot "<br> Shutdown(18)<br> Case " Shutdown "<br> Shutdown(13)<br> EndSwitch<br> EndIf<br> WaitforWakeup()<br>EndFunc ;==>RunAfterLullaby<br><br>Func WaitforWakeup()<br> Local $ConvertedHour, $ConvertedMinutes, $Timesplit<br> ;ControlClick("X-Lorem Ipsum", "", "SysTabControl321", "left", 1, 75, 10)<br> $Timesplit = StringSplit(Number(StringFormat("%04d",StringRegExpReplace(GUICtrlRead($Input_AlarmTime), "\D", ""))), "")<br> If StringInStr(GUICtrlRead($Input_AlarmTime), "p") Then<br> Switch $Timesplit[0]<br> Case 3<br> $ConvertedHour = $Timesplit[1] + 12<br> $ConvertedMinutes = $Timesplit[2] & $Timesplit[3]<br> If $ConvertedHour = 24 Then $ConvertedHour = 0<br> GUICtrlSetData($Tab2_Label5, "Wakeup Case 3a, waiting till " & $ConvertedHour & $ConvertedMinutes)<br> Case 4<br> If ($Timesplit[1] & $Timesplit[2]) = 12 Then<br> $ConvertedHour = $Timesplit[1] & $Timesplit[2]<br> Else<br> $ConvertedHour = ($Timesplit[1] & $Timesplit[2]) + 12<br> EndIf<br> $ConvertedMinutes = $Timesplit[3] & $Timesplit[4]<br> If $ConvertedHour = 24 Then $ConvertedHour = 0<br> GUICtrlSetData($Tab2_Label5, "Wakeup Case 4a, waiting till " & $ConvertedHour & $ConvertedMinutes)<br> EndSwitch<br> #cs<br> Do<br> Sleep(100)<br> Until Number($ConvertedHour & $ConvertedMinutes) = @Hour & @Min<br> #ce<br> Else<br> Switch $Timesplit[0]<br> Case 3<br> $ConvertedHour = $Timesplit[1]<br> $ConvertedMinutes = $Timesplit[2] & $Timesplit[3]<br> GUICtrlSetData($Tab2_Label5, "Wakeup Case 3b, waiting till " & $ConvertedHour & $ConvertedMinutes & "(" & @HOUR & ":" & @MIN & ")")<br> Case 4<br> If ($Timesplit[1] & $Timesplit[2]) = 12 Then<br> $ConvertedHour = 0<br> Else<br> $ConvertedHour = $Timesplit[1] & $Timesplit[2]<br> EndIf<br> $ConvertedMinutes = $Timesplit[3] & $Timesplit[4]<br> GUICtrlSetData($Tab2_Label5, "Wakeup Case 4b, waiting till " & $ConvertedHour & $ConvertedMinutes)<br> EndSwitch<br> #cs<br> Do<br> Sleep(100)<br> Until Number($ConvertedHour & $ConvertedMinutes) = @Hour & @Min<br> #ce<br> EndIf<br> Do<br> Sleep(100)<br> Until $ConvertedHour & $ConvertedMinutes = @Hour & @Min<br> Sleep(100)<br> WakeupNow()<br>EndFunc ;==>WaitforWakeup<br><br>Func WakeupNow()<br> If _Winamp_GetCurrentTrackPlayStatus() Then<br> _Winamp_Stop()<br> Sleep(100)<br> EndIf<br> HotKeySet("{SPACE}", "Snooze")<br> GUICtrlSetData($Tab2_Label8, " - Enabled") ;Spacebar (snooze)<br> GUICtrlSetData($Tab2_Label5, "Time to start..")<br> _Winamp_SetVolume(0)<br> If GUICtrlRead($Input_PlaylistorFile) <> "Playlist or File" Then ; Or GUICtrlRead($Input_PlaylistorFile) <> ""<br> Switch $RndORSel<br> Case 0 ;Pick<br> _Winamp_ClearPlayList()<br> _Winamp_AddFile($SelectedSong)<br> _Winamp_Play()<br> Case 1 ;Random<br> _Winamp_ClearPlayList()<br> _Winamp_AddFile(StringReplace($MusicPath[0], ";", ":"))<br> _Winamp_Play()<br> EndSwitch<br> ElseIf GUICtrlRead($Combo_WinAmpStart) = " Start Playing " Then<br> _Winamp_Play()<br> EndIf<br> ;ControlClick("X-Lorem Ipsum", "", "SysTabControl321", "left", 1, 115, 10)<br> GUICtrlSetData($Tab2_Label5, "Fade In..")<br> Fadein(GUICtrlRead($Slider_Fadein_Time), GUICtrlRead($Slider_MaxVol))<br> GUICtrlSetData($Tab2_Label5, "Done for now..")<br> GUICtrlSetData($Tab2_Label8, " - Disabled") ; Spacebar (snooze)<br> HotKeySet("{SPACE}")<br>EndFunc ;==>WakeupNow<br><br>Func Fadein($FadeTime, $MaxVolume)<br> ; If the Main is muted, un-mute it<br> PixelSearch(1260, 780, 1275, 790, 0xFF0000)<br> If Not @error Then Send("{VOLUME_MUTE}")<br> ;<br> Switch @OSVersion<br> Case "WIN_VISTA"<br> Run("sndvol.exe", "", @SW_HIDE)<br> Case "WIN_XP"<br> Run("sndvol32.exe", "", @SW_HIDE)<br> Case "WIN_7"<br> Run("sndvol.exe", "", @SW_HIDE)<br> EndSwitch<br> WinWaitActive("Volume Mixer")<br> ControlSend("Volume Mixer", "", "msctls_trackbar321", "{HOME}") ; Max system volume<br> WinClose("Volume Mixer")<br> If _Winamp_GetVolume() = 0 Then<br> Do<br> _Winamp_SetVolume(-1, 1)<br> Sleep($FadeTime * 35)<br> $CurrentVolume = _Winamp_GetVolume()<br> Until $CurrentVolume / 255 * 100 >= $MaxVolume<br> Else<br> MsgBox(0, "", ";==>Fadein: Winamp has volume, Quitting Fadein.", 2)<br> EndIf<br>EndFunc ;==>Fadein<br><br>Func Update_FadeInTime()<br> If GUICtrlRead($Slider_Fadein_Time) <> $Old_Slider1_Value Then<br> GUICtrlSetData($Slider_Fadein_Time_Value, GUICtrlRead($Slider_Fadein_Time))<br> $Old_Slider1_Value = GUICtrlRead($Slider_Fadein_Time)<br> IniWrite($IniFile, "Levels", "FadeInTime", GUICtrlRead($Slider_Fadein_Time))<br> EndIf<br>EndFunc ;==>Update_FadeInTime<br><br>Func Update_MaxVolume()<br> If GUICtrlRead($Slider_MaxVol) <> $Old_Slider2_Value Then<br> GUICtrlSetData($Slider_MaxVol_Value, GUICtrlRead($Slider_MaxVol))<br> $Old_Slider2_Value = GUICtrlRead($Slider_MaxVol)<br> IniWrite($IniFile, "Levels", "MaxVolume", GUICtrlRead($Slider_MaxVol))<br> EndIf<br>EndFunc ;==>Update_MaxVolume<br><br>Func VolUpDownMute()<br> Switch @HotKeyPressed<br> Case "{F2}"<br> Send("{VOLUME_MUTE}")<br> Case "{F3}"<br> Send("{VOLUME_DOWN}")<br> Case "{F4}"<br> Send("{VOLUME_UP}")<br> EndSwitch<br>EndFunc<br><br>Func Snooze()<br> HotKeySet("{SPACE}", "Quit")<br> ;HotKeySet("{SPACE}", "Restart")<br> GUICtrlSetData($Tab2_Label8, " - Snooze")<br> Local $SnoozeTime = Number(GUICtrlRead($Input_Snooze))<br> Local $SnoozeTill = _DateAdd('n', $SnoozeTime, _NowCalc())<br> GUICtrlSetData($Tab2_Label5, "Snoozing for " & $SnoozeTime & " minutes, since " & @HOUR & ":" & @MIN & ", to " & StringTrimLeft(StringTrimRight($SnoozeTill, 3), 11))<br> If Not BitAND(WinGetState("X-Lorem Ipsum"), 2) Then SplashTextOn("", "Snoozing for " & $SnoozeTime & " minutes, since " & @HOUR & ":" & @MIN & ", to " & StringTrimLeft(StringTrimRight($SnoozeTill, 3), 11), 850, 55, 200, 630, 33, "Comic Sans MS", 20)<br> _Winamp_Stop()<br> Do<br> Sleep(10)<br> Until @HOUR & ":" & @MIN = StringTrimLeft(StringTrimRight($SnoozeTill, 3), 11)<br> SplashOff()<br> _Winamp_SetVolume(0)<br> _Winamp_Play()<br> HotKeySet("{SPACE}", "Snooze")<br> GUICtrlSetData($Tab2_Label8, " - Enabled")<br> Fadein(GUICtrlRead($Slider_Fadein_Time), GUICtrlRead($Slider_MaxVol))<br>EndFunc ;==>Snooze<br><br>Func PickMusic()<br> $RndORSel = 0<br> GUICtrlSetState($Input_PlaylistorFile, $GUI_ENABLE)<br> ;Highlander()<br> Local $Drive, $Dir, $FName, $Ext<br> $SelectedSong = FileOpenDialog("Select Song", "C:\Users\Public\Music\Music", "Media files (*.mp3;*.m4a;*.m3u) | All (*.*)")<br> If @error Then<br> $SelectedSong = IniRead($IniFile, "Wakeup File", "SoundFile", "NotFound")<br> Else<br> IniWriteSection($IniFile, "Wakeup File", "SoundFile=" & $SelectedSong)<br> EndIf<br> $MusicPath = StringSplit($SelectedSong, "\")<br> GUICtrlSetData($Input_PlaylistorFile, StringTrimRight($MusicPath[$MusicPath[0]], 4))<br>EndFunc ;==>PickMusic<br><br>Func RndMusic()<br> $RndORSel = 1<br> GUICtrlSetState($Input_PlaylistorFile, $GUI_ENABLE)<br> ;Highlander()<br> Local $Folder, $Drive, $Dir, $FName, $Ext<br> $Folder = FileSelectFolder("Select A Music Folder", "C:\Users\Public\Music\Music", 6)<br> $FileList = _FileListToArray($Folder, "*", 1)<br> If @error = 1 Then<br> MsgBox(0, "", "No Files\Folders Found.")<br> Exit<br> EndIf<br> Do<br> $RandomFile = Random(1, $FileList[0], 1)<br> $MusicPath = _PathSplit($Folder & "\" & $FileList[$RandomFile], $Drive, $Dir, $FName, $Ext)<br> Until $MusicPath[4] = ".mp3" Or $MusicPath[4] = ".m4a" Or $MusicPath[4] = ".m3u"<br> GUICtrlSetData($Input_PlaylistorFile, $FileList[$RandomFile])<br>EndFunc ;==>RndMusic<br><br>Func ToggleHide()<br> If BitAND(WinGetState("X-Lorem Ipsum", ""), 2) Then<br> WinSetState("X-Lorem Ipsum", "", @SW_HIDE)<br> Else<br> WinSetState("X-Lorem Ipsum", "", @SW_SHOW)<br> EndIf<br>EndFunc ;==>ToggleHide<br><br>Func Highlander()<br> Switch @GUI_CtrlId<br> Case $Checkbox_Winamp_Wakeup<br> If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE)<br> GUICtrlSetState($Input_Snooze, $GUI_ENABLE)<br> GUICtrlSetState($Checkbox_Direct, $GUI_UNCHECKED)<br> Case $Button_Pick, $Button_Random, $Checkbox_Direct<br> If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE)<br> GUICtrlSetState($Input_Snooze, $GUI_ENABLE)<br> GUICtrlSetState($Checkbox_Winamp_Wakeup, $GUI_UNCHECKED)<br> EndSwitch<br>EndFunc ;==>Highlander<br><br>Func CheckStartCombo()<br> Switch GUICtrlRead($Combo_WinAmpStart)<br> Case " Winamp "<br> GUICtrlSetState($Input_AlarmTime, $GUI_DISABLE)<br> GUICtrlSetState($Input_Snooze, $GUI_DISABLE)<br> GUICtrlSetData($Input_PlaylistorFile, "Playlist or File")<br> GUICtrlSetState($Input_PlaylistorFile, $GUI_DISABLE)<br> Case " Start Playing "<br> If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE)<br> GUICtrlSetState($Input_Snooze, $GUI_ENABLE)<br> Case " Select "<br> If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE)<br> GUICtrlSetState($Input_Snooze, $GUI_ENABLE)<br> PickMusic()<br> Case " Random "<br> If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE)<br> GUICtrlSetState($Input_Snooze, $GUI_ENABLE)<br> RndMusic()<br> EndSwitch<br>EndFunc<br><br>Func GetTitle()<br> GUICtrlSetState($Input_Title, $GUI_ENABLE)<br> While 1<br> ToolTip("Click on the App now")<br> Sleep(50)<br> If _IsPressed("01") Then ExitLoop<br> WEnd<br> ToolTip("")<br> GUICtrlSetData($Input_Title, WinGetTitle("[active]"))<br>EndFunc ;==>GetTitle<br><br>Func CheckTimeCombo()<br> Switch GUICtrlRead($Combo_TimeFrame)<br> Case " Specific Time "<br> GUICtrlSetState($Input_Time, $GUI_ENABLE)<br> GUICtrlSetData($Input_Time, "4:20")<br> Case " Hour.Hour "<br> GUICtrlSetState($Input_Time, $GUI_ENABLE)<br> GUICtrlSetData($Input_Time, "2.5")<br> Case " Hour,Minute "<br> GUICtrlSetState($Input_Time, $GUI_ENABLE)<br> GUICtrlSetData($Input_Time, "2,30")<br> Case " Minute "<br> GUICtrlSetState($Input_Time, $GUI_ENABLE)<br> GUICtrlSetData($Input_Time, "150")<br> Case " Lullaby Time "<br> GUICtrlSetState($Input_Time, $GUI_DISABLE)<br> GUICtrlSetData($Input_Time, "")<br> EndSwitch<br>EndFunc ;==>CheckTimeCombo<br><br>Func SlidersSave()<br> IniWrite($IniFile, "Levels", "FadeInTime", GUICtrlRead($Slider_Fadein_Time))<br> IniWrite($IniFile, "Levels", "MaxVolume", GUICtrlRead($Slider_MaxVol))<br>EndFunc<br><br>Func WriteSnoozeTime()<br> IniWrite($IniFile, "Snooze Time", "SnoozeTime", GUICtrlRead($Input_Snooze))<br> ;MsgBox(0, "Snooze Time", "$Input_Snooze = " & $Input_Snooze & " GUI_CtrlId = " & @GUI_CtrlId & @LF)<br>EndFunc<br><br>Func WriteAlarmTime()<br> IniWrite($IniFile, "Alarm Time", "AlarmTime", GUICtrlRead($Input_AlarmTime))<br> ;MsgBox(0, "Alarm Time", "GUI_CtrlId = " & @GUI_CtrlId & @LF)<br>EndFunc<br><br>Func MouseOverTray()<br> If BitAND(WinGetState("X-Lorem Ipsum", ""), 2) Then<br> TrayItemSetText($TrayToggleHide, "Hide Window")<br> Else<br> TrayItemSetText($TrayToggleHide, "Show Window")<br> EndIf<br>EndFunc<br><br>Func ToggleHotKey()<br> Switch $HotKeyAble<br> Case 0<br> TrayItemSetText($TrayToggleHotKey, "Disable Hotkeys")<br> GUICtrlSetData($Tab2_Label7, " >- Enabled")<br> HotKeySet("{F2}", "VolUpDownMute")<br> HotKeySet("{F3}", "VolUpDownMute")<br> HotKeySet("{F4}", "VolUpDownMute")<br> HotKeySet("{F10}", "ToggleHide")<br> HotKeySet("{SPACE}", "Snooze")<br> $HotKeyAble = 1<br> Case 1<br> TrayItemSetText($TrayToggleHotKey, "Enable Hotkeys")<br> GUICtrlSetData($Tab2_Label7, " |- Disabled")<br> HotKeySet("{F2}")<br> HotKeySet("{F3}")<br> HotKeySet("{F4}")<br> HotKeySet("{F10}")<br> HotKeySet("{SPACE}")<br> $HotKeyAble = 0<br> EndSwitch<br>EndFunc ;==>ToggleHotKey<br><br>Func CheckWinampStop()<br> If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_DISABLE)<br>EndFunc<br><br>Func Restart()<br> If @HotKeyPressed = "{SPACE}" Then _Winamp_Play()<br> $MouPos = WinGetPos("X-Lorem Ipsum")<br> If $MouPos[0] & "," & $MouPos[1] <> "10,535" Then IniWrite($IniFile, "XLorem Position", "XPos", $MouPos[0] & ", " & $MouPos[1])<br>; Restart your program - http://www.autoitscript.com/forum/index.php?s=&showtopic=19370&view=findpost&p=199608<br>; Author UP_NORTH<br> If @Compiled = 1 Then<br> Run(FileGetShortName(@ScriptFullPath))<br> Else<br> Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))<br> EndIf<br> Exit<br>EndFunc ;==>Restart<br><br>Func Quit()<br> If @HotKeyPressed = "{SPACE}" Then _Winamp_Play()<br> Exit<br>EndFunc ;==>Quit<br><br> Edited March 6, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change.
somdcomputerguy Posted March 6, 2011 Author Posted March 6, 2011 (edited) expandcollapse popup#include <misc.au3> Sleep(250) If _Singleton("X-Lorem Ipsum",1) = 0 Then Msgbox(0,"Warning","An occurence of X-Lorem Ipsum is already running", 3) Exit EndIf #include <file.au3> #include <date.au3> #include <string.au3> #include <guitab.au3> #include <constants.au3> #include <editconstants.au3> #include <winamp_library.au3> ; http://www.autoitscript.com/forum/topic/71187-winamp-library-on-pure-autoit/ #include <guiconstantsex.au3> #include <comboconstants.au3> #include <sliderconstants.au3> #include <buttonconstants.au3> #include <windowsconstants.au3> #include <progressconstants.au3> #include <datetimeconstants.au3> #Region ### START Opts and Declarations section ### Opt("TrayMenuMode", 3) Opt("SendKeyDelay", 150) ;Opt("TrayIconDebug", 1) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("TrayOnEventMode", 1) Opt("MustDeclareVars", 1) Opt("WinTitleMatchMode", 2) Local $TrayToggleHide, $TrayRestart, $TrayExit, $TrayToggleHotKey Local $Form, $Tab, $Tab0, $Tab1, $Tab2, $Tab2_Label1, $Tab2_Label2, $Tab2_Label3, $Tab2_Label4, $Tab2_Label5, $Tab2_Label6, $Tab2_Label7, $Tab2_Label8 Global $Input_PlaylistorFile, $Input_Snooze, $Input_Time, $Input_Title Global $Combo_WinAmpStop, $Combo_Shutdown, $Combo_TimeFrame, $Combo_WinAmpStart Global $Slider_Fadein_Time, $Slider_Fadein_Time_Value, $Old_Slider1_Value, $Slider_MaxVol, $Slider_MaxVol_Value, $Old_Slider2_Value Global $Button_Begin, $Button_GetTitle, $Button_Pick, $Button_Random, $Progressbar Global $Countdown, $CountdownTotal, $CountdownToDate, $CurrentVolume, $MaxVolume Global $SelectedSong, $FadeTime, $CountdownTime, $Input_AlarmTime, $AlarmTimeData, $FileList, $RandomFile, $Folder Global $IniFile = @ScriptDir & "\X-Lorem.ini" Global $RndORSel, $MusicPath, $Restart, $MouPos, $HotKeyAble = 1, $Checkbox_Fade #EndRegion ### END Opts and Declarations section ### #Region ### START HotKeySet and INI section ### HotKeySet("{F2}", "VolUpDownMute") ;ToggleMute HotKeySet("{F3}", "VolUpDownMute") ;VolDown HotKeySet("{F4}", "VolUpDownMute") ;VolUp HotKeySet("{F10}", "ToggleHide") $AlarmTimeData = IniRead($IniFile, "Alarm Time", "AlarmTime", @HOUR & ":" & @MIN) $MouPos = StringSplit(IniRead($IniFile, "XLorem Position", "XPos", 10 & "," & 535), ",") #EndRegion ### END HotKeySet and INI section section ### #Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\koda\Forms\LoremIpsum.kxf If $MouPos[0] & ", " & $MouPos[1] <> "15, " & @DesktopHeight - 275 And StringIsDigit($MouPos[0]) And StringIsDigit($MouPos[1]) Then $Form = GUICreate("X-Lorem Ipsum", 450, 200, $MouPos[1], $MouPos[2], Default, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW) Else $Form = GUICreate("X-Lorem Ipsum", 450, 200, 15, @DesktopHeight - 275, Default, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW) EndIf GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetIcon("1998_low_cost_clock.ico") GUISetBkColor(0xc0c0c0) $Tab = GUICtrlCreateTab(-1, -1, 450, 200) GUICtrlSetResizing($Tab, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) ; $Tab0 = GUICtrlCreateTabItem("Lullaby") $Combo_WinAmpStop = GUICtrlCreateCombo(" WinAmp ", 15, 40, 115, 20) GUICtrlSetData($Combo_WinAmpStop, " Just Stop | Stop-n-Play | Stop When Done | End Program ") GUICtrlSetTip($Combo_WinAmpStop, " Just Stop " & @LF & " Stop-n-Play - Stop playing, go right to Wakeup " & @LF & " Stop When Done - Stop after the current song ends " & @LF & " End Program ", " How To Stop Winamp.. ", 1) GUICtrlSetOnEvent($Combo_WinAmpStop, "CheckWinampStop") $Combo_TimeFrame = GUICtrlCreateCombo(" Lullaby Time ", 170, 40, 115, 20) GUICtrlSetData($Combo_TimeFrame, " Specific Time | Hour.Hour | Hour,Minute | Minute ") GUICtrlSetOnEvent($Combo_TimeFrame, "CheckTimeCombo") GUICtrlSetTip($Combo_TimeFrame, " Specific Time - 4:20 " & @LF & " Hour.Hour - 2.5 - 2 hours 30 minutes " & @LF & " Hour,Minute - 2,30 - 2 hours 30 minutes " & @LF & " Minute - 150 - 2 hours 30 minutes ", " Lullaby Time ", 1) $Input_Time = GUICtrlCreateInput("", 340, 40, 65, 25, $ES_CENTER) GUICtrlSetState($Input_Time, $GUI_DISABLE) $Combo_Shutdown = GUICtrlCreateCombo(" Shutdown Options ", 100, 75, 200, 20) GUICtrlSetData($Combo_Shutdown, " Lock | Standby | Hibernate | Reboot | Shutdown") GUICtrlSetTip($Combo_Shutdown, " Lock " & @LF & " Standby " & @LF & " Hibernate " & @LF & " Reboot " & @LF & " Shutdown ", " Shutdown Options ", 1) $Input_Title = GUICtrlCreateInput("Close Title", 100, 115, 250, 25, $ES_CENTER) GUICtrlSetState($Input_Title, $GUI_DISABLE) $Button_GetTitle = GUICtrlCreateButton("Title", 20, 115, 60, 25) GUICtrlSetOnEvent($Button_GetTitle, "GetTitle") $Button_Begin = GUICtrlCreateButton("Begin", 170, 160, 100, 25) GUICtrlSetOnEvent($Button_Begin, "Lullaby") $Checkbox_Fade = GUICtrlCreateCheckbox("Fade", 90, 160, 60, 20) ; $Tab1 = GUICtrlCreateTabItem("Wakeup") $Combo_WinAmpStart = GUICtrlCreateCombo(" WinAmp ", 190, 35, 115, 20) GUICtrlSetData($Combo_WinAmpStart, " Start Playing | Select | Random ") GUICtrlSetOnEvent($Combo_WinAmpStart, "CheckStartCombo") #cs $Checkbox_Winamp_Wakeup = GUICtrlCreateCheckbox("Winamp", 190, 35, 85, 20) GUICtrlSetOnEvent($Checkbox_Winamp_Wakeup, "Highlander") $Checkbox_Direct = GUICtrlCreateCheckbox(" Direct", 190, 55, 85, 20) GUICtrlSetOnEvent($Checkbox_Direct, "Highlander") $Button_Pick = GUICtrlCreateButton("Pick", 298, 30, 40, 20) GUICtrlSetOnEvent($Button_Pick, "PickMusic") $Button_Random = GUICtrlCreateButton("Random", 285, 60, 65, 20) GUICtrlSetOnEvent($Button_Random, "RndMusic") #ce $Button_Begin = GUICtrlCreateButton("Begin", 170, 160, 100, 25) GUICtrlSetOnEvent($Button_Begin, "Lullaby") $Input_AlarmTime = GUICtrlCreateInput($AlarmTimeData, 158, 125, 65, 25, $ES_CENTER) GUICtrlSetState($Input_AlarmTime, $GUI_DISABLE) GUICtrlSetOnEvent($Input_AlarmTime, "WriteAlarmTime") GUICtrlCreateLabel("Wakeup", 100, 126) $Input_PlaylistorFile = GUICtrlCreateInput("Playlist or File", 85, 90, 275, 25, $ES_CENTER) GUICtrlSetState($Input_PlaylistorFile, $GUI_DISABLE) $Input_Snooze = GUICtrlCreateInput(IniRead($IniFile, "Snooze Time", "SnoozeTime", 9), 285, 125, 25, 25, $ES_CENTER) GUICtrlSetState($Input_Snooze, $GUI_DISABLE) GUICtrlSetOnEvent($Input_Snooze, "WriteSnoozeTime") GUICtrlCreateLabel("Snooze", 230, 126) GUICtrlCreateLabel("Minute(s)", 315, 126) $Slider_Fadein_Time = GUICtrlCreateSlider(10, 55, 15, 85, $TBS_VERT) GUICtrlCreateLabel("Fade In Time", 10, 35) GUICtrlSetOnEvent($Slider_Fadein_Time, "Update_FadeInTime") GUICtrlSetLimit($Slider_Fadein_Time, 20, 0) GUICtrlSetData($Slider_Fadein_Time, IniRead($IniFile, "Levels", "FadeInTime", 5)) $Slider_Fadein_Time_Value = GUICtrlCreateLabel(GUICtrlRead($Slider_Fadein_Time), 135, 35) $Slider_MaxVol = GUICtrlCreateSlider(40, 80, 15, 85, $TBS_VERT) GUICtrlCreateLabel("Max Volume", 40, 60) GUICtrlSetOnEvent($Slider_MaxVol, "Update_MaxVolume") GUICtrlSetLimit($Slider_MaxVol, 100, 0) GUICtrlSetData($Slider_MaxVol, IniRead($IniFile, "Levels", "MaxVolume", 85)) $Slider_MaxVol_Value = GUICtrlCreateLabel(GUICtrlRead($Slider_MaxVol), 145, 60) $Checkbox_Fade = GUICtrlCreateCheckbox("Fade", 90, 160, 60, 20) ; $Tab2 = GUICtrlCreateTabItem("Info") ;$Tab2_Label1 = GUICtrlCreateLabel("[Ctrl+Alt]+ESC - Quit", 10, 25) $Tab2_Label3 = GUICtrlCreateLabel("SPACE - 1x -> Snooze 2x -> Restart" & @LF & @LF & "F2/F3/F4 - Volume Mute/Down/Up" & @LF & "F10 - Window Show/Hide", 10, 95) ;$Tab2_Label2 = GUICtrlCreateLabel("F2/F3/F4 - Volume Mute/Down/Up", 10, 73) ;$Tab2_Label4 = GUICtrlCreateLabel("F10 - Window Show/Hide", 10, 93) $Tab2_Label5 = GUICtrlCreateLabel("Text", 10, 35, 500) ;$Tab2_Label6 = GUICtrlCreateLabel("Hr.Hr (1.5 = 1 Hour and 30 Minutes)" & @LF & "Hr,Min (1,5 = 1 Hour and 5 Minutes)", 10, 130) $Tab2_Label7 = GUICtrlCreateLabel(" >- Enabled", 242, 135) $Tab2_Label8 = GUICtrlCreateLabel(" - Not Enabled", 245, 95) $Progressbar = GUICtrlCreateProgress(50, 60, 335, 22, -1, $PBS_SMOOTH) GUICtrlSetColor($Progressbar, 0x00ff00) ; GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### #Region ### START Tray section ### $TrayToggleHide = TrayCreateItem("Show/Hide") TrayItemSetOnEvent(-1, "ToggleHide") $TrayToggleHotKey = TrayCreateItem("Disable Hotkeys") TrayItemSetOnEvent(-1, "ToggleHotKey") $TrayRestart = TrayCreateItem("Restart") TrayItemSetOnEvent(-1, "Restart") $TrayExit = TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "Quit") ; TraySetState() TraySetClick(9) TraySetIcon(@ScriptDir & "\1998_low_cost_clock.ico") TraySetToolTip("X-Lorem Ipsum - Click here for the menu..") TraySetOnEvent($TRAY_EVENT_MOUSEOVER,"MouseOverTray") #EndRegion ### END Tray section ### While 1 Sleep(100) WEnd Func Lullaby() If GUICtrlRead($Combo_WinAmpStop) = " Stop-n-Play " And GUICtrlRead($Combo_WinAmpStart) = " WinAmp " Then MsgBox(0, "", "You must select a startup thing too you know..") Restart() EndIf ControlClick("X-Lorem Ipsum", "", "SysTabControl321", "left", 1, 135, 10) If GUICtrlRead($Checkbox_Fade) = $GUI_CHECKED Then For $iTransValue = 250 To 5 Step -15 WinSetTrans("X-Lorem Ipsum", "", $iTransValue) Sleep(10) Next WinSetState("X-Lorem Ipsum", "", @SW_HIDE) WinSetTrans("X-Lorem Ipsum", "", 255) EndIf Local $TimeFraction, $ConvertedHour, $ConvertedMinutes, $Timesplit If GUICtrlRead($Combo_TimeFrame) <> " Lullaby Time " Then Switch GUICtrlRead($Combo_TimeFrame) Case " Hour.Hour " If StringInStr(GUICtrlRead($Input_Time), ".") Then $TimeFraction = StringSplit(GUICtrlRead($Input_Time), ".") $CountdownToDate = _DateAdd('n', (60 * $TimeFraction[1]) + ((60 * $TimeFraction[2]) / 10), _NowCalc()) GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour.Hour - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour.Hour" & @LF & "$TimeFraction[1] - " & $TimeFraction[1] & @LF & "$TimeFraction[2] - " & $TimeFraction[2] & @LF & $CountdownToDate & @LF) Else $CountdownToDate = _DateAdd('h', GUICtrlRead($Input_Time), _NowCalc()) GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour.Hour - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & @LF & $CountdownToDate & @LF) EndIf Case " Hour,Minute " If StringInStr(GUICtrlRead($Input_Time), ",") Then $TimeFraction = StringSplit(GUICtrlRead($Input_Time), ",") $CountdownToDate = _DateAdd('n', (60 * $TimeFraction[1]) + $TimeFraction[2], _NowCalc()) GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour,Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour,Minute" & @LF & "$TimeFraction[1] - " & $TimeFraction[1] & @LF & "$TimeFraction[2] - " & $TimeFraction[2] & @LF & $CountdownToDate & @LF) Else $CountdownToDate = _DateAdd('h', GUICtrlRead($Input_Time), _NowCalc()) GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Hour,Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & @LF & $CountdownToDate & @LF) EndIf Case " Minute " If StringInStr(GUICtrlRead($Input_Time), ".") Then $TimeFraction = StringSplit(GUICtrlRead($Input_Time), ".") $CountdownToDate = _DateAdd('s', (60 * $TimeFraction[1]) + ((60 * $TimeFraction[2]) / 10), _NowCalc()) GUICtrlSetData($Tab2_Label5, "$Input_Time - " & GUICtrlRead($Input_Time) & " Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) ;MsgBox(0, "", "$Input_Time - " & GUICtrlRead($Input_Time) & " Minute" & @LF & "$TimeFraction[1] - " & $TimeFraction[1] & @LF & "$TimeFraction[2] - " & $TimeFraction[2] & @LF & $CountdownToDate & @LF) Else $CountdownToDate = _DateAdd('n', GUICtrlRead($Input_Time), _NowCalc()) GUICtrlSetData($Tab2_Label5, _NowCalc() & " - " & GUICtrlRead($Input_Time) & " Minute - " & StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) ;MsgBox(0, "", _NowCalc() & @LF & GUICtrlRead($Input_Time) & @LF & $CountdownToDate & @LF) EndIf Case " Specific Time " $Timesplit = StringSplit(Number(StringFormat("%04d",StringRegExpReplace(GUICtrlRead($Input_Time), "\D", ""))), "") If StringInStr(GUICtrlRead($Input_Time), "p") Then Switch $Timesplit[0] Case 3 $ConvertedHour = $Timesplit[1] + 12 $ConvertedMinutes = $Timesplit[2] & $Timesplit[3] If $ConvertedHour = 24 Then $ConvertedHour = 00 GUICtrlSetData($Tab2_Label5, "Lullaby Switch 3a, Waiting till " & $ConvertedHour & $ConvertedMinutes) Case 4 If ($Timesplit[1] & $Timesplit[2]) = 12 Then $ConvertedHour = $Timesplit[1] & $Timesplit[2] Else $ConvertedHour = ($Timesplit[1] & $Timesplit[2]) + 12 EndIf $ConvertedMinutes = $Timesplit[3] & $Timesplit[4] If $ConvertedHour = 24 Then $ConvertedHour = 00 GUICtrlSetData($Tab2_Label5, "Lullaby Switch 4a, Waiting till " & $ConvertedHour & $ConvertedMinutes) EndSwitch Else Switch $Timesplit[0] Case 3 $ConvertedHour = $Timesplit[1] $ConvertedMinutes = $Timesplit[2] & $Timesplit[3] GUICtrlSetData($Tab2_Label5, "Lullaby Switch 3b, Waiting till " & $ConvertedHour & $ConvertedMinutes) Case 4 If ($Timesplit[1] & $Timesplit[2]) = 12 Then $ConvertedHour = 0 Else $ConvertedHour = $Timesplit[1] & $Timesplit[2] EndIf $ConvertedMinutes = $Timesplit[3] & $Timesplit[4] GUICtrlSetData($Tab2_Label5, "Lullaby Switch 4b, Waiting till " & $ConvertedHour & $ConvertedMinutes) EndSwitch EndIf Do Sleep(100) Until $ConvertedHour & $ConvertedMinutes = @Hour & @Min #cs Do Sleep(10) Until Number(StringFormat("%04d",StringRegExpReplace(GUICtrlRead($Input_Time), "\D", ""))) = Number(@Hour & @Min) ;http://www.autoitscript.com/forum/topic/123103-how-to-check-systemtime/page__view__findpost__p__855050 #ce EndSwitch If GUICtrlRead($Combo_TimeFrame) <> " Specific Time " Then Local $DateDiffCalc = _DateDiff( 'n', _NowCalc(), $CountdownToDate) Local $TotalDateDiffCalc = $DateDiffCalc GUICtrlSetData($Progressbar, ($DateDiffCalc / $TotalDateDiffCalc) * 100) Do $DateDiffCalc = _DateDiff( 'n', _NowCalc(), $CountdownToDate) If $DateDiffCalc <> $TotalDateDiffCalc Then GUICtrlSetData($Progressbar, ($DateDiffCalc / $TotalDateDiffCalc) * 100) Sleep(10) ;Until Number(StringTrimRight(StringTrimLeft($CountdownToDate, 11), 3)) = @HOUR & ":" & @MIN Until $CountdownToDate <= _NowCalc() GUICtrlSetData($Progressbar, 0) EndIf EndIf RunAfterLullaby() EndFunc ;==>Lullaby Func RunAfterLullaby() GUICtrlSetData($Tab2_Label5, "NightNight..") If GUICtrlRead($Combo_WinAmpStop) <> " WinAmp " Then Switch GUICtrlRead($Combo_WinAmpStop) Case " Just Stop " _Winamp_Stop() Case " Stop-n-Play " WakeupNow() Case " Stop When Done " ControlSend("Winamp", "", "", "^v") Case " End Program " _Winamp_Close() EndSwitch EndIf If GUICtrlRead($Input_Title) <> "Close Title" Then WinClose(GUICtrlRead($Input_Title)) If GUICtrlRead($Combo_Shutdown) <> " Shutdown Options " Then Switch GUICtrlRead($Combo_Shutdown) Case " Lock " Run("rundll32.exe user32.dll, LockWorkStation") Case " Standby " Shutdown(32) Case " Hibernate " Shutdown(64) Case " Reboot " Shutdown(18) Case " Shutdown " Shutdown(13) EndSwitch EndIf WaitforWakeup() EndFunc ;==>RunAfterLullaby Func WaitforWakeup() Local $ConvertedHour, $ConvertedMinutes, $Timesplit ;ControlClick("X-Lorem Ipsum", "", "SysTabControl321", "left", 1, 75, 10) $Timesplit = StringSplit(Number(StringFormat("%04d",StringRegExpReplace(GUICtrlRead($Input_AlarmTime), "\D", ""))), "") If StringInStr(GUICtrlRead($Input_AlarmTime), "p") Then Switch $Timesplit[0] Case 3 $ConvertedHour = $Timesplit[1] + 12 $ConvertedMinutes = $Timesplit[2] & $Timesplit[3] If $ConvertedHour = 24 Then $ConvertedHour = 0 GUICtrlSetData($Tab2_Label5, "Wakeup Case 3a, waiting till " & $ConvertedHour & $ConvertedMinutes) Case 4 If ($Timesplit[1] & $Timesplit[2]) = 12 Then $ConvertedHour = $Timesplit[1] & $Timesplit[2] Else $ConvertedHour = ($Timesplit[1] & $Timesplit[2]) + 12 EndIf $ConvertedMinutes = $Timesplit[3] & $Timesplit[4] If $ConvertedHour = 24 Then $ConvertedHour = 0 GUICtrlSetData($Tab2_Label5, "Wakeup Case 4a, waiting till " & $ConvertedHour & $ConvertedMinutes) EndSwitch #cs Do Sleep(100) Until Number($ConvertedHour & $ConvertedMinutes) = @Hour & @Min #ce Else Switch $Timesplit[0] Case 3 $ConvertedHour = $Timesplit[1] $ConvertedMinutes = $Timesplit[2] & $Timesplit[3] GUICtrlSetData($Tab2_Label5, "Wakeup Case 3b, waiting till " & $ConvertedHour & $ConvertedMinutes & "(" & @HOUR & ":" & @MIN & ")") Case 4 If ($Timesplit[1] & $Timesplit[2]) = 12 Then $ConvertedHour = 0 Else $ConvertedHour = $Timesplit[1] & $Timesplit[2] EndIf $ConvertedMinutes = $Timesplit[3] & $Timesplit[4] GUICtrlSetData($Tab2_Label5, "Wakeup Case 4b, waiting till " & $ConvertedHour & $ConvertedMinutes) EndSwitch #cs Do Sleep(100) Until Number($ConvertedHour & $ConvertedMinutes) = @Hour & @Min #ce EndIf Do Sleep(100) Until Number($ConvertedHour & $ConvertedMinutes) = @Hour & @Min Sleep(100) WakeupNow() EndFunc ;==>WaitforWakeup Func WakeupNow() If _Winamp_GetCurrentTrackPlayStatus() Then _Winamp_Stop() Sleep(100) EndIf HotKeySet("{SPACE}", "Snooze") GUICtrlSetData($Tab2_Label8, " - Enabled") ;Spacebar (snooze) GUICtrlSetData($Tab2_Label5, "Time to start..") _Winamp_SetVolume(0) If GUICtrlRead($Input_PlaylistorFile) <> "Playlist or File" Then ; Or GUICtrlRead($Input_PlaylistorFile) <> "" Switch $RndORSel Case 0 ;Pick _Winamp_ClearPlayList() _Winamp_AddFile($SelectedSong) _Winamp_Play() Case 1 ;Random _Winamp_ClearPlayList() _Winamp_AddFile(StringReplace($MusicPath[0], ";", ":")) _Winamp_Play() EndSwitch ElseIf GUICtrlRead($Combo_WinAmpStart) = " Start Playing " Then _Winamp_Play() EndIf ;ControlClick("X-Lorem Ipsum", "", "SysTabControl321", "left", 1, 115, 10) GUICtrlSetData($Tab2_Label5, "Fade In..") Fadein(GUICtrlRead($Slider_Fadein_Time), GUICtrlRead($Slider_MaxVol)) GUICtrlSetData($Tab2_Label5, "Done for now..") GUICtrlSetData($Tab2_Label8, " - Disabled") ; Spacebar (snooze) HotKeySet("{SPACE}") EndFunc ;==>WakeupNow Func Fadein($FadeTime, $MaxVolume) ; If the Main is muted, un-mute it PixelSearch(1260, 780, 1275, 790, 0xFF0000) If Not @error Then Send("{VOLUME_MUTE}") ; Switch @OSVersion Case "WIN_VISTA" Run("sndvol.exe", "", @SW_HIDE) Case "WIN_XP" Run("sndvol32.exe", "", @SW_HIDE) Case "WIN_7" Run("sndvol.exe", "", @SW_HIDE) EndSwitch WinWaitActive("Volume Mixer") ControlSend("Volume Mixer", "", "msctls_trackbar321", "{HOME}") ; Max system volume WinClose("Volume Mixer") If _Winamp_GetVolume() = 0 Then Do _Winamp_SetVolume(-1, 1) Sleep($FadeTime * 35) $CurrentVolume = _Winamp_GetVolume() Until $CurrentVolume / 255 * 100 >= $MaxVolume Else MsgBox(0, "", ";==>Fadein: Winamp has volume, Quitting Fadein.", 2) EndIf EndFunc ;==>Fadein Func Update_FadeInTime() If GUICtrlRead($Slider_Fadein_Time) <> $Old_Slider1_Value Then GUICtrlSetData($Slider_Fadein_Time_Value, GUICtrlRead($Slider_Fadein_Time)) $Old_Slider1_Value = GUICtrlRead($Slider_Fadein_Time) IniWrite($IniFile, "Levels", "FadeInTime", GUICtrlRead($Slider_Fadein_Time)) EndIf EndFunc ;==>Update_FadeInTime Func Update_MaxVolume() If GUICtrlRead($Slider_MaxVol) <> $Old_Slider2_Value Then GUICtrlSetData($Slider_MaxVol_Value, GUICtrlRead($Slider_MaxVol)) $Old_Slider2_Value = GUICtrlRead($Slider_MaxVol) IniWrite($IniFile, "Levels", "MaxVolume", GUICtrlRead($Slider_MaxVol)) EndIf EndFunc ;==>Update_MaxVolume Func VolUpDownMute() Switch @HotKeyPressed Case "{F2}" Send("{VOLUME_MUTE}") Case "{F3}" Send("{VOLUME_DOWN}") Case "{F4}" Send("{VOLUME_UP}") EndSwitch EndFunc Func Snooze() HotKeySet("{SPACE}", "Quit") ;HotKeySet("{SPACE}", "Restart") GUICtrlSetData($Tab2_Label8, " - Snooze") Local $SnoozeTime = Number(GUICtrlRead($Input_Snooze)) Local $SnoozeTill = _DateAdd('n', $SnoozeTime, _NowCalc()) GUICtrlSetData($Tab2_Label5, "Snoozing for " & $SnoozeTime & " minutes, since " & @HOUR & ":" & @MIN & ", to " & StringTrimLeft(StringTrimRight($SnoozeTill, 3), 11)) If Not BitAND(WinGetState("X-Lorem Ipsum"), 2) Then SplashTextOn("", "Snoozing for " & $SnoozeTime & " minutes, since " & @HOUR & ":" & @MIN & ", to " & StringTrimLeft(StringTrimRight($SnoozeTill, 3), 11), 850, 55, 200, 630, 33, "Comic Sans MS", 20) _Winamp_Stop() Do Sleep(10) Until @HOUR & ":" & @MIN = StringTrimLeft(StringTrimRight($SnoozeTill, 3), 11) SplashOff() _Winamp_SetVolume(0) _Winamp_Play() HotKeySet("{SPACE}", "Snooze") GUICtrlSetData($Tab2_Label8, " - Enabled") Fadein(GUICtrlRead($Slider_Fadein_Time), GUICtrlRead($Slider_MaxVol)) EndFunc ;==>Snooze Func PickMusic() $RndORSel = 0 GUICtrlSetState($Input_PlaylistorFile, $GUI_ENABLE) ;Highlander() Local $Drive, $Dir, $FName, $Ext $SelectedSong = FileOpenDialog("Select Song", "C:\Users\Public\Music\Music", "Media files (*.mp3;*.m4a;*.m3u) | All (*.*)") If @error Then $SelectedSong = IniRead($IniFile, "Wakeup File", "SoundFile", "NotFound") Else IniWriteSection($IniFile, "Wakeup File", "SoundFile=" & $SelectedSong) EndIf $MusicPath = StringSplit($SelectedSong, "\") GUICtrlSetData($Input_PlaylistorFile, StringTrimRight($MusicPath[$MusicPath[0]], 4)) EndFunc ;==>PickMusic Func RndMusic() $RndORSel = 1 GUICtrlSetState($Input_PlaylistorFile, $GUI_ENABLE) ;Highlander() Local $Folder, $Drive, $Dir, $FName, $Ext $Folder = FileSelectFolder("Select A Music Folder", "C:\Users\Public\Music\Music", 6) $FileList = _FileListToArray($Folder, "*", 1) If @error = 1 Then MsgBox(0, "", "No Files\Folders Found.") Exit EndIf Do $RandomFile = Random(1, $FileList[0], 1) $MusicPath = _PathSplit($Folder & "\" & $FileList[$RandomFile], $Drive, $Dir, $FName, $Ext) Until $MusicPath[4] = ".mp3" Or $MusicPath[4] = ".m4a" Or $MusicPath[4] = ".m3u" GUICtrlSetData($Input_PlaylistorFile, $FileList[$RandomFile]) EndFunc ;==>RndMusic Func ToggleHide() If BitAND(WinGetState("X-Lorem Ipsum", ""), 2) Then WinSetState("X-Lorem Ipsum", "", @SW_HIDE) Else WinSetState("X-Lorem Ipsum", "", @SW_SHOW) EndIf EndFunc ;==>ToggleHide Func Highlander() Switch @GUI_CtrlId Case $Checkbox_Winamp_Wakeup If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE) GUICtrlSetState($Input_Snooze, $GUI_ENABLE) GUICtrlSetState($Checkbox_Direct, $GUI_UNCHECKED) Case $Button_Pick, $Button_Random, $Checkbox_Direct If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE) GUICtrlSetState($Input_Snooze, $GUI_ENABLE) GUICtrlSetState($Checkbox_Winamp_Wakeup, $GUI_UNCHECKED) EndSwitch EndFunc ;==>Highlander Func CheckStartCombo() Switch GUICtrlRead($Combo_WinAmpStart) Case " Winamp " GUICtrlSetState($Input_AlarmTime, $GUI_DISABLE) GUICtrlSetState($Input_Snooze, $GUI_DISABLE) GUICtrlSetData($Input_PlaylistorFile, "Playlist or File") GUICtrlSetState($Input_PlaylistorFile, $GUI_DISABLE) Case " Start Playing " If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE) GUICtrlSetState($Input_Snooze, $GUI_ENABLE) Case " Select " If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE) GUICtrlSetState($Input_Snooze, $GUI_ENABLE) PickMusic() Case " Random " If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_ENABLE) GUICtrlSetState($Input_Snooze, $GUI_ENABLE) RndMusic() EndSwitch EndFunc Func GetTitle() GUICtrlSetState($Input_Title, $GUI_ENABLE) While 1 ToolTip("Click on the App now") Sleep(50) If _IsPressed("01") Then ExitLoop WEnd ToolTip("") GUICtrlSetData($Input_Title, WinGetTitle("[active]")) EndFunc ;==>GetTitle Func CheckTimeCombo() Switch GUICtrlRead($Combo_TimeFrame) Case " Specific Time " GUICtrlSetState($Input_Time, $GUI_ENABLE) GUICtrlSetData($Input_Time, "4:20") Case " Hour.Hour " GUICtrlSetState($Input_Time, $GUI_ENABLE) GUICtrlSetData($Input_Time, "2.5") Case " Hour,Minute " GUICtrlSetState($Input_Time, $GUI_ENABLE) GUICtrlSetData($Input_Time, "2,30") Case " Minute " GUICtrlSetState($Input_Time, $GUI_ENABLE) GUICtrlSetData($Input_Time, "150") Case " Lullaby Time " GUICtrlSetState($Input_Time, $GUI_DISABLE) GUICtrlSetData($Input_Time, "") EndSwitch EndFunc ;==>CheckTimeCombo Func SlidersSave() IniWrite($IniFile, "Levels", "FadeInTime", GUICtrlRead($Slider_Fadein_Time)) IniWrite($IniFile, "Levels", "MaxVolume", GUICtrlRead($Slider_MaxVol)) EndFunc Func WriteSnoozeTime() IniWrite($IniFile, "Snooze Time", "SnoozeTime", GUICtrlRead($Input_Snooze)) ;MsgBox(0, "Snooze Time", "$Input_Snooze = " & $Input_Snooze & " GUI_CtrlId = " & @GUI_CtrlId & @LF) EndFunc Func WriteAlarmTime() IniWrite($IniFile, "Alarm Time", "AlarmTime", GUICtrlRead($Input_AlarmTime)) ;MsgBox(0, "Alarm Time", "GUI_CtrlId = " & @GUI_CtrlId & @LF) EndFunc Func MouseOverTray() If BitAND(WinGetState("X-Lorem Ipsum", ""), 2) Then TrayItemSetText($TrayToggleHide, "Hide Window") Else TrayItemSetText($TrayToggleHide, "Show Window") EndIf EndFunc Func ToggleHotKey() Switch $HotKeyAble Case 0 TrayItemSetText($TrayToggleHotKey, "Disable Hotkeys") GUICtrlSetData($Tab2_Label7, " >- Enabled") HotKeySet("{F2}", "VolUpDownMute") HotKeySet("{F3}", "VolUpDownMute") HotKeySet("{F4}", "VolUpDownMute") HotKeySet("{F10}", "ToggleHide") HotKeySet("{SPACE}", "Snooze") $HotKeyAble = 1 Case 1 TrayItemSetText($TrayToggleHotKey, "Enable Hotkeys") GUICtrlSetData($Tab2_Label7, " |- Disabled") HotKeySet("{F2}") HotKeySet("{F3}") HotKeySet("{F4}") HotKeySet("{F10}") HotKeySet("{SPACE}") $HotKeyAble = 0 EndSwitch EndFunc ;==>ToggleHotKey Func CheckWinampStop() If GUICtrlRead($Combo_WinAmpStop) <> " Stop-n-Play " Then GUICtrlSetState($Input_AlarmTime, $GUI_DISABLE) EndFunc Func Restart() If @HotKeyPressed = "{SPACE}" Then _Winamp_Play() $MouPos = WinGetPos("X-Lorem Ipsum") If $MouPos[0] & "," & $MouPos[1] <> "10,535" Then IniWrite($IniFile, "XLorem Position", "XPos", $MouPos[0] & ", " & $MouPos[1]) ; Restart your program - http://www.autoitscript.com/forum/index.php?s=&showtopic=19370&view=findpost&p=199608 ; Author UP_NORTH If @Compiled = 1 Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc ;==>Restart Func Quit() If @HotKeyPressed = "{SPACE}" Then _Winamp_Play() Exit EndFunc ;==>Quit </datetimeconstants.au3></progressconstants.au3></windowsconstants.au3></buttonconstants.au3></sliderconstants.au3></comboconstants.au3></guiconstantsex.au3></winamp_library.au3></editconstants.au3></constants.au3></guitab.au3></string.au3></date.au3></file.au3></misc.au3> Edited March 7, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now