kamuran731 Posted February 6, 2012 Share Posted February 6, 2012 yaptığım programın çalar saat gibi mesela saat 7 ve 10 da beni uyarmasını uyar notu vermesini istiyorum. bunu nasıl yapabilirim? Quote Link to comment Share on other sites More sharing options...
Mehmet Posted February 7, 2012 Share Posted February 7, 2012 (edited) burada bir kodlama var ama bilmem işine yararmı sanırım bir Timer.ini dosyası oluşturup verilerini oradan çekebilirsin alıntıdır yanlız [codebox] #include <Sound.au3> ;Will play a random mp3 in script directory. ;Load all times, format shown below ;Weekday,Hour,Min ;1|08|15| $Ini = IniReadSection(@ScriptDir & "\Timer.ini", 'TriBe') ;Get list of all mp3s in folder. $MP3 = _FileListToArray(@ScriptDir, '*.mp3') ;Create array that matches the number of alarms. Global $MyArray[$Ini[0][0] + 1][3] $MyArray[0][0] = $Ini[0][0] ;Convert ini string to array for internal use. For $i = 1 To $Ini[0][0] $Tmp = StringSplit($Ini[$i][1], '|') For $j = 1 To 3 $MyArray[$i][$j - 1] = $Tmp[$j] Next Next ;Check every second. AdlibRegister('_CheckAlarm', 750) ;Show me current time. ConsoleWrite(@WDAY & ' ~ ' & @HOUR & ' ~ ' & @MIN & @CRLF) While 1 Sleep(100) WEnd Func _CheckAlarm() ;Loop through all alarms For $X = 1 To $MyArray[0][0] ;If it is time to wake up, play a song. If $MyArray[$X][0] == @WDAY And $MyArray[$X][1] == @HOUR And $MyArray[$X][2] == @MIN Then _PlayAlarm($X) Next EndFunc ;==>_CheckAlarm Func _PlayAlarm($X) ;Generate a random number. $Tmp = Random(1, $MP3[0], 1) ;Open random MP3 $Sound = _SoundOpen(@ScriptDir & '\' & $MP3[$Tmp]) _SoundPlay($Sound) ;Wait till I press Ok on the message box, if I don't play another song. While Not (MsgBox(0, 'Morning!', 'Have a good day!', _SoundLength($Sound, 2) / 1000) == 1) _SoundStop($Sound) $Tmp = Random(1, $MP3[0], 1) $Sound = _SoundOpen(@ScriptDir & '\' & $MP3[$Tmp]) _SoundPlay($Sound) WEnd ;Shut the fuck up. _SoundStop($Sound) ;Wait till current minute is over. While $MyArray[$X][2] == @MIN Sleep(1000) WEnd EndFunc ;==>_PlayAlarm Func _FileListToArray($sPath, $sFilter = "*", $iFlag = 0) Local $hSearch, $sFile, $sFileList, $sDelim = "|" $sPath = StringRegExpReplace($sPath, "[\\/]+\z", "") & "\" ; ensure single trailing backslash If Not FileExists($sPath) Then Return SetError(1, 1, "") If StringRegExp($sFilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "") If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") $hSearch = FileFindFirstFile($sPath & $sFilter) If @error Then Return SetError(4, 4, "") While 1 $sFile = FileFindNextFile($hSearch) If @error Then ExitLoop If ($iFlag + @extended = 2) Then ContinueLoop $sFileList &= $sDelim & $sFile WEnd FileClose($hSearch) If Not $sFileList Then Return SetError(4, 4, "") Return StringSplit(StringTrimLeft($sFileList, 1), "|") EndFunc;==>_FileListToArray [/codebox] Edited February 7, 2012 by MeHMeTBeN Quote Link to comment Share on other sites More sharing options...
kamuran731 Posted February 7, 2012 Author Share Posted February 7, 2012 line 69 hatası verdi anlamadım olmadı Quote Link to comment Share on other sites More sharing options...
MostWanted Posted February 8, 2012 Share Posted February 8, 2012 https://rapidshare.com/files/1296976292/tnctr.alarm.ornegi.rar Senin için çok basit bi örnek yaptım.İniyi benim dolduruğum gibi doldur.Günler zaten au3 dosyasında nasıl yazılacağı belli.Kolay gelsin. Quote Link to comment Share on other sites More sharing options...
kamuran731 Posted February 8, 2012 Author Share Posted February 8, 2012 (edited) @MostWanted Hocam çalıştı çok güzel olmuş ellerine sağlık. yanlız belli bir tarihte çalmasını sağlamak için ne yapmalıyız mesela 27/02/2012 pzt saat 18:00 da çalmasını istiyorum. Ayrıca date picker ekleyip ordan seçtiğimiz tarihi Timer.ini ye yazdırtabilirmiyiz.? Edited February 8, 2012 by kamuran731 Quote Link to comment Share on other sites More sharing options...
MostWanted Posted February 8, 2012 Share Posted February 8, 2012 (edited) Aslında dediklerinin tamamı projenin içinde cevaplı.Mesela herhangi bir gün dedin değil mi?Ben projede örnek olarak ne yaptım ini ye verileri girdim ve şu anki durumla karşılaştırdım.O zaman senin yapman gereken iniye tarih diye bi değer girmen ve bunu okutup ordaki if de şu anki durumla eşitlemen.Diğer dediğini sormaman bile gerek.Zaten bu obje onun için yapılmış.Tek gereken verileri okuman ve bunları iniye yazdırman.Kolay gelsin. Edited February 8, 2012 by MostWanted Quote Link to comment Share on other sites More sharing options...
kamuran731 Posted February 9, 2012 Author Share Posted February 9, 2012 (edited) hocam Func _CheckAlarm() fonsiyonuna aşağıdaki Tarih satırını ekledim $Tarih=IniRead($inidir, $Ini[$i],"Tarih", "00.12.2012") if kısmını ise aşağıdaki gibi yaptım If $gun = bugun() And $saat = @HOUR&":" &@MIN And $Tarih = @MDAY&"." @MON& "." &@YEAR Then _PlayAlarm($mesaj) Sleep(60000) EndIf iniye yazdığım tarih ve saatte çalışıyor ama [color="#FF0000"][b] if hatası veriyor[/b][/color] Edited February 9, 2012 by kamuran731 Quote Link to comment Share on other sites More sharing options...
MostWanted Posted February 9, 2012 Share Posted February 9, 2012 Küçük hatalar gerçekten insanlarını delirtir.Şöyle düzelt; If $gun = bugun() And $saat = @HOUR&":" &@MIN And $Tarih = @MDAY&"."& @MON& "." &@YEAR Then Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.