onedayillpay Posted December 21, 2006 Posted December 21, 2006 im durt poor cant afford a clock so ill make one one proble... #include <Date.au3> MsgBox(0,'',"The time is:" & _NowTime()) While 1 if _NowTime = 05:30:00 Then ; "05:30:00, {05:30:00, (05:30:00, tryed all differnt kinds of combinations, 05 * 30 * 00 MsgBox(0,"wake","up") EndIf WEnd
Bert Posted December 21, 2006 Posted December 21, 2006 try this: #include <Date.au3> MsgBox(0,'',"The time is:" & _NowTime()) While 1 if _NowTime() = "05:30:00" Then ; "05:30:00, {05:30:00, (05:30:00, tryed all differnt kinds of combinations, 05 * 30 * 00 MsgBox(0,"wake","up") EndIf WEnd The Vollatran project My blog: http://www.vollysinterestingshit.com/
onedayillpay Posted December 21, 2006 Author Posted December 21, 2006 still wont work... maybe you have to add "05:30:00 PM" or use return or something... i have been looking threw the Date.au3 file to see if i can find the proper way to do this... but all i can realy do is try randum things, no luck at all
FreeFry Posted December 21, 2006 Posted December 21, 2006 #include <Date.au3> While 1 If _NowTime(4) = "21:31" Then ; added the 4 parameter, to exclude the seconds(i dont think if you wake one second later makes any difference :P) MsgBox(0,"wake","up") EndIf Sleep(100) WEnd Though I bet you a million that you wont wake from a messagebox
onedayillpay Posted December 21, 2006 Author Posted December 21, 2006 (edited) Though I bet you a million that you wont wake from a messagebox tRue... some music will work tho... lol "18:00" would be 8:00 oclock right... :"> Edited December 21, 2006 by onedayillpay
BigDod Posted December 21, 2006 Posted December 21, 2006 tRue... some music will work tho... lol 18:00 would be 8:00 oclock right... :">20:00 is 8:00 Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
smstroble Posted December 22, 2006 Posted December 22, 2006 (edited) Voila! An alarm clock, no speaker required even :-) #include <Date.au3> Alarm() Func Alarm() sleep(6000) ;so that the alarm does not go off again when you press space HotKeySet("{SPACE}") While 1 If _NowTime(4) = "21:31" Then ; added the 4 parameter, to exclude the seconds(i dont think if you wake one second later makes any difference tongue.gif) While 1 HotKeySet("{SPACE}", "Alarm") ;resets alarm Beep(500, 500) Beep(1000, 500);dont have to remeber to turn speakers on :-) Beep(1500, 500) Beep(1500, 500) Beep(1000, 500) Beep(500, 500) WEnd EndIf Sleep(100) WEnd EndFunc play with the lengths and frequencys of the beeps, find the most annoying thing possible :-) Edited December 22, 2006 by smstroble MUHAHAHAHAHA
chie Posted December 22, 2006 Posted December 22, 2006 I made this for mycelf & im pretty happy with it at the moment,try it out. expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown global $song, $Go, $Tray_exititem_item, $Secs, $Mins, $Hour, $time_,$rest_time_window ;~ Gui 1 ;~ ------------------------------------------------------------------------------------------------------- $mainwindow = GUICreate("Alarm", 400, 100) $slider = GUICtrlCreateSlider (190,70,200,20,$TBS_NOTICKS) ;Slider GUICtrlSetLimit(-1,100,0) ; change min/max value GUICtrlSetData(-1,_SoundGetWaveVolume()) ; set cursor ;~ ------------------------------------------------------------------------------------------------------- $browse = GUICtrlCreateButton("Browse", 5, 10, 50, 20) ;Browse Button $start = GUICtrlCreateButton("Start", 5, 34, 50, 20) ;Browse Button $e1 = GUICtrlCreateInput("", 60, 10, 330, 20) ;Are Where the chosen song is displayed ;~ ------------------------------------------------------------------------------------------------------- $iniread_Hour = IniRead("C:\myfile.ini", "Alarm", "hour","") $iniread_Min = IniRead("C:\myfile.ini", "Alarm", "min","") $input_ALARM_data = GUICtrlCreateCombo ($iniread_Hour, 60,70,40, 20) ; create first item GUICtrlSetData(-1,"00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24",$iniread_Hour) ; add other item snd set a new default $input_ALARM_data2 = GUICtrlCreateCombo ($iniread_Min, 100,70,40, 20) ; create first item GUICtrlSetData(-1,"|00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60",$iniread_Min) ; add other item snd set a new default ;~ ------------------------------------------------------------------------------------------------------- $Checkbox_RestReminder = GUICtrlCreateCheckbox("Remind to rest every 1.H", 60, 38) GUISetState(@SW_SHOW) ; makes Gui Visible ;~ Gui 2 ;~ ------------------------------------------------------------------------------------------------------- $rest_time_window = GUICreate("RestReminder", 400, 100) $font="Comic Sans MS" GUISetFont (30, 400, 1, $font) ; will display underlined characters GUICtrlCreateLabel ("TIME TO REST !!!",35,20) GUICtrlSetColor(-1,0xff) ;blue GUISetState(@SW_HIDE) ; makes Gui Visible ;~ ********************************************************************************************************* ;~ Tray MENU ;~ --------------------------------------------------------------------------------------------------------- $Tray_Maximize_item = TrayCreateItem("Maximize") $settingsitem = TrayCreateMenu("Rest opt.") $Enable = TrayCreateItem("Enable", $settingsitem) $Disnable = TrayCreateItem("Disable", $settingsitem) TrayCreateItem("") $Tray_exititem_item = TrayCreateItem("Exit") TraySetState(@SW_HIDE) if GUICtrlRead($Checkbox_RestReminder) = $GUI_UNCHECKED Then TraySetState(4) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _SoundGetWaveVolume() ; get the et Wav Sound Volume (Author gafrost) Local $WaveVol = -1, $p, $ret Const $MMSYSERR_NOERROR = 0 $p = DllStructCreate ("dword") If @error Then SetError(2) Return -2 EndIf $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr ($p)) If ($ret[0] == $MMSYSERR_NOERROR) Then $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData ($p, 1), 8), 4)) / 0xFFFF * 100) Else SetError(1) EndIf $Struct=0 Return $WaveVol EndFunc;==>_SoundGetWaveVolume While 1 SoundSetWaveVolume(GUICtrlRead($slider)) ; set slider to current volume value ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $msg = GUIGetMsg() $msg1 = TrayGetMsg() Select Case $msg1 = $Tray_exititem_item Exit Case $msg = $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE,$mainwindow) GUISetState(@SW_HIDE,$rest_time_window) ;~ --------------------------------------------------------------------------------------------------------- Case $msg = $GUI_EVENT_CLOSE _CLOSEClicked() ; call _CLOSEClicked() funtion ;~ --------------------------------------------------------------------------------------------------------- Case $msg1 = $Tray_Maximize_item GUISetState(@SW_SHOW,$mainwindow) GUISetState(@SW_RESTORE,$mainwindow) ;~ -------------------------------------------------------------- ;~ Changing Tray icon modes , Blinking & not blinking case $msg1 = $Enable TraySetState(8) GUICtrlSetState($Checkbox_RestReminder,$GUI_CHECKED) case $msg1 = $Disnable TraySetState(4) GUICtrlSetState($Checkbox_RestReminder,$GUI_UNCHECKED) ;~ -------------------------------------------------------------- Case $msg = $Checkbox_RestReminder And BitAND(GUICtrlRead($Checkbox_RestReminder), $GUI_CHECKED) = $GUI_CHECKED TraySetState(8) Case $msg = $Checkbox_RestReminder And BitAND(GUICtrlRead($Checkbox_RestReminder), $GUI_UNCHECKED) = $GUI_UNCHECKED TraySetState(4) ;~ -------------------------------------------------------------- Case $msg = $browse _Browse() ; call _Browse() funtion Case $msg = $start GUISetState(@SW_HIDE,$mainwindow) AdlibEnable("_CheckTime", 60000) ; checks time every 1 minute (calls _CheckTime() function ) EndSelect WEnd Func _CLOSEClicked() ;Exit GUI function $Hwnd = WinGetHandle('') If $Hwnd = $rest_time_window Then GUISetState(@SW_HIDE,$rest_time_window) ElseIf $Hwnd = $mainwindow Then Exit EndIf ;~ SoundSetWaveVolume(50) ;if u close GUI Sleep(100) EndFunc Func _Browse() ;opens desktop after pressing Browse button & lets u choose files $song = FileOpenDialog("Play MP3/WAV sound", @DesktopDir, "MP3 sound (*.mp3;*.wav;*.wma)", 1 + 4) ;~ SoundSetWaveVolume(0) ; setting volume $mid = $song While 1 $songstr = StringInStr($mid, "\") If $songstr = 0 Then ExitLoop $mid = StringMid($mid, $songstr + 1) WEnd $sk = $mid ;Sets chosen song name into the Are Where the chosen song is displayed GUICtrlSetData($e1, $sk) ;~ AdlibEnable("_CheckTime", 60000) ; checks time every 1 minute EndFunc ;==>Browse ;Alarm settings Func _CheckTime() IniWrite("C:\myfile.ini", "Alarm", "hour",GUICtrlRead($input_ALARM_data)) IniWrite("C:\myfile.ini", "Alarm", "min",GUICtrlRead($input_ALARM_data2)) $hour = @HOUR $minute = @MIN $time_ = $hour & ":" & $minute if GUICtrlRead($Checkbox_RestReminder) = $GUI_CHECKED Then ; Reast reminder time matching If $time_ = "00:00" Then _play_it() If $time_ = "01:00" Then _play_it() If $time_ = "02:00" Then _play_it() If $time_ = "03:00" Then _play_it() If $time_ = "04:00" Then _play_it() If $time_ = "05:00" Then _play_it() If $time_ = "06:00" Then _play_it() If $time_ = "07:00" Then _play_it() If $time_ = "08:00" Then _play_it() If $time_ = "09:00" Then _play_it() If $time_ = "10:00" Then _play_it() If $time_ = "11:00" Then _play_it() If $time_ = "12:00" Then _play_it() If $time_ = "13:00" Then _play_it() If $time_ = "14:00" Then _play_it() If $time_ = "15:00" Then _play_it() If $time_ = "16:00" Then _play_it() If $time_ = "17:00" Then _play_it() If $time_ = "18:00" Then _play_it() If $time_ = "19:00" Then _play_it() If $time_ = "20:00" Then _play_it() If $time_ = "21:00" Then _play_it() If $time_ = "22:00" Then _play_it() If $time_ = "23:00" Then _play_it() EndIf If $time_ = GUICtrlRead($input_ALARM_data) & ":" & GUICtrlRead($input_ALARM_data2) Then ; if time matches play the sound ;~ ------------------------------------- GUICtrlSetData($slider,100) ; set slider to 100 & Volume = 100 then GUICtrlRead($song); read the song SoundPlay($song) ; play it ;~ ------------------------------------- EndIf EndFunc Func _play_it() ;~ ---------------------------------------------------------------------------------------- GUISetState(@SW_SHOW,$rest_time_window) GUISetState(@SW_RESTORE,$rest_time_window) GUICtrlSetData($slider,100) ; set slider to 100 & Volume = 100 then GUICtrlRead($song); read the song SoundPlay($song) ; play it Sleep(5000) if WinExists("RestReminder") Then GUISetState(@SW_HIDE,$rest_time_window) ;~ ---------------------------------------------------------------------------------------- EndFunc
Valik Posted December 23, 2006 Posted December 23, 2006 Voila! An alarm clock, no speaker required even :-)Errr, yes, a speaker is required. The speaker just happens to typically be in the case.
smstroble Posted December 26, 2006 Posted December 26, 2006 Errr, yes, a speaker is required. The speaker just happens to typically be in the case.Bah, your so picky. you still dont have to turn it on or anything, and i cant think of a computer that doesnt have one.So (need an angry looking one) lol. MUHAHAHAHAHA
xcal Posted December 26, 2006 Posted December 26, 2006 (need an angry looking one) lol. How To Ask Questions The Smart Way
Valik Posted December 26, 2006 Posted December 26, 2006 Bah, your so picky. you still dont have to turn it on or anything, and i cant think of a computer that doesnt have one.So (need an angry looking one) lol.Well... mine doesn't have one, for example. Neither does a PC I was sent.
_Kurt Posted December 26, 2006 Posted December 26, 2006 If you have speakers, blast up the volume and add this to your script: SoundPlay(@WindowsDir & "\media\NOTIFY.WAV",1) Sleep(1000) SoundPlay(@WindowsDir & "\media\NOTIFY.WAV",1) Sleep(1000) SoundPlay(@WindowsDir & "\media\NOTIFY.WAV",1) Sleep(1000) SoundPlay(@WindowsDir & "\media\NOTIFY.WAV",1) Also, add a TimerInit so if you end up falling back to sleep, it will wait 10 minutes and replay the sounds. Hope that helps, Kurt Awaiting Diablo III..
funcwtf Posted January 10, 2007 Posted January 10, 2007 (edited) May not be the best code you've ever read, but I just made this last night and fixed a time issue i was getting with the _Now() function, this evening. Simple & Practical. Anywho, my only issue with it right now, is when I start the alarm clock, and then click cancel, it takes multiple clicks and/or a few second wait for it to actually recognize the user input. I realize i have the adlib command set to 2000 (2 seconds) but even without that it's slow, is there a better way to do this? expandcollapse popup#include <GuiConstants.au3> #include <date.au3> $Window = GUICreate("iTunes Alarm Clock", 350, 175) ; will create a dialog box that when displayed is centered $WindowTitle = "iTunes Alarm Clock" GUISetState () ;;Labels GuictrlcreateLabel( "Alarm Set Time:", 25, 30) GUICtrlCreateLabel("Path to Folder: ", 25, 55) GUICtrlCreateLabel("SearchMusic:", 25, 80) ;;Inputs $InputAlarmTime = GUICtrlCreateInput( _Now(), 100, 25, 125) $InputProgPath = GUICtrlCreateInput( "C:\Program Files (x86)\Utilities\iTunes", 100, 50, 225) $InputProgExe = guictrlRead($InputProgPath) & "\itunes.exe" $InputProgPathname = GUICtrlRead($InputProgPath) $InputFind = GUICtrlCreateInput("", 100, 75, 100) $Cancel = GUICtrlCreateButton("&Cancel", 210, 115) $SetAlarm = GUICtrlCreateButton("&Set Alarm", 85, 115) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Cancel Exit Case $msg = $SetAlarm AdlibEnable( "TerminateCheck",2000) $AlarmTime = GuiCtrlRead($InputAlarmTime) $FindPlay = GUICtrlRead($InputFind) Do winsetstate($WindowTitle, "", @sw_Minimize) $Now = _Now() If $Now >= $AlarmTime Then Run($InputProgExe,$InputProgPathname) sleep(4000) ControlFocus("iTunes", "", 101) sleep(1000) Send($FindPlay) Send(@CR & @CR & @TAB) sleep(5000) ControlFocus("iTunes", "", 101) ControlSend("iTunes", "", 101, " ") Exit EndIf Until $Now > $AlarmTime + 1 EndSelect WEnd Func TerminateCheck() $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit ElseIf $msg = $Cancel Then Exit EndIf EndFunc Edited January 10, 2007 by funcwtf
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