Swimming_Bird Posted January 16, 2006 Share Posted January 16, 2006 For some reason this is using 17% of my cpu and about 4 megs of ram: expandcollapse popup#include <Date.au3> #include <Array.au3> Const $tickhour = 60*60*1000 Const $tickmin = 60*1000 Global $int=$tickhour Func _alarm () Run ( @ProgramFilesDir & '\winamp\winamp.exe' ) ProcessWait ( "winamp.exe" ) SoundSetWaveVolume ( 15 ) Run ( 'CLAmp.exe /VOLSET 26 /PLAY' ) Return ( $tickmin-1000 ) EndFunc While 1 If Not FileExists ( 'alarmconfig.ini' ) Then IniWrite ( 'alarmconfig.ini' , 'Sunday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Monday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Tuesday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Wednesday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Thursday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Friday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Saturday' , '1' , '' ) EndIf If @WDAY = 1 Then $day = 'Sunday' If @WDAY = 2 Then $day = 'Monday' If @WDAY = 3 Then $day = 'Tuesday' If @WDAY = 4 Then $day = 'Wednesday' If @WDAY = 5 Then $day = 'Thursday' If @WDAY = 6 Then $day = 'Friday' If @WDAY = 7 Then $day = 'Saturday' $alarmini = IniReadSection ( 'alarmconfig.ini' , $day ) Global $inta[$alarmini[0][0]+1] $inta[0]=$tickhour If Not @error Then For $n = 1 To $alarmini[0][0] If $alarmini[$n][1] = '' Then ExitLoop Local $hour = StringLeft ( $alarmini[$n][1] , 2 ) Local $min = StringRight ( $alarmini[$n][1] , 2 ) Local $sec = 0 Local $CurrentTick = _TimeToTicks(@HOUR,@MIN,@SEC) Local $endTick = _TimeToTicks( $hour , $min , $sec ) Local $ticktill=$endTick-$CurrentTick If $ticktill < $tickhour Then $inta[$n]=$tickmin * 30;if within an hour then poll every 30 min If $ticktill < $tickmin*30 Then $inta[$n]=$tickmin * 5;if within 30 min poll every 5 min If $ticktill < $tickmin*5 Then $inta[$n]=$tickmin; if within 5 min poll every min If $ticktill < $tickmin Then $inta[$n]=1000; if within a min then poll every second If $ticktill < 1001 And $ticktill > 0 Then $inta[$n]=_alarm(); if within a second then set off the alarm Next EndIf $int = _ArrayMin ( $inta );set the poll interval to the smallest set one. Sleep ( $int ) WEnd Link to comment Share on other sites More sharing options...
Oxin8 Posted January 16, 2006 Share Posted January 16, 2006 (edited) i use an alarm script that uses winamp too... mine seems to suck about 40-50 cpu usage right now so i don't know about lowering the resources on yours. If you're only using it when you're sleeping it's not a huge problem, is it? Edited January 16, 2006 by Oxin8 ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 Had you thought about instead of making it a While Loop just making it a function... That way you could do: expandcollapse popup#include <Date.au3> #include <Array.au3> Const $tickhour = 60*60*1000 Const $tickmin = 60*1000 Global $int=$tickhour AdlibEnable('CheckTime', 60000) While 1 Sleep(1000) Wend Func _alarm () Run ( @ProgramFilesDir & '\winamp\winamp.exe' ) ProcessWait ( "winamp.exe" ) SoundSetWaveVolume ( 15 ) Run ( 'CLAmp.exe /VOLSET 26 /PLAY' ) Return ( $tickmin-1000 ) EndFunc Func CheckTime() If Not FileExists ( 'alarmconfig.ini' ) Then IniWrite ( 'alarmconfig.ini' , 'Sunday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Monday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Tuesday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Wednesday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Thursday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Friday' , '1' , '' ) IniWrite ( 'alarmconfig.ini' , 'Saturday' , '1' , '' ) EndIf If @WDAY = 1 Then $day = 'Sunday' If @WDAY = 2 Then $day = 'Monday' If @WDAY = 3 Then $day = 'Tuesday' If @WDAY = 4 Then $day = 'Wednesday' If @WDAY = 5 Then $day = 'Thursday' If @WDAY = 6 Then $day = 'Friday' If @WDAY = 7 Then $day = 'Saturday' $alarmini = IniReadSection ( 'alarmconfig.ini' , $day ) Global $inta[$alarmini[0][0]+1] $inta[0]=$tickhour If Not @error Then For $n = 1 To $alarmini[0][0] If $alarmini[$n][1] = '' Then ExitLoop Local $hour = StringLeft ( $alarmini[$n][1] , 2 ) Local $min = StringRight ( $alarmini[$n][1] , 2 ) Local $sec = 0 Local $CurrentTick = _TimeToTicks(@HOUR,@MIN,@SEC) Local $endTick = _TimeToTicks( $hour , $min , $sec ) Local $ticktill=$endTick-$CurrentTick If $ticktill < $tickhour Then $inta[$n]=$tickmin * 30;if within an hour then poll every 30 min If $ticktill < $tickmin*30 Then $inta[$n]=$tickmin * 5;if within 30 min poll every 5 min If $ticktill < $tickmin*5 Then $inta[$n]=$tickmin; if within 5 min poll every min If $ticktill < $tickmin Then $inta[$n]=1000; if within a min then poll every second If $ticktill < 1001 And $ticktill > 0 Then $inta[$n]=_alarm(); if within a second then set off the alarm Next EndIf $int = _ArrayMin ( $inta );set the poll interval to the smallest set one. EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
greenmachine Posted January 16, 2006 Share Posted January 16, 2006 i use an alarm script that uses winamp too... mine seems to suck about 40-50 cpu usage right now so i don't know about lowering the resources on yours. If you're only using it when you're sleeping it's not a huge problem, is it?Haha that's a good point, and that reminds me. If you're not at the computer, why not make it use more of the CPU? There are plenty of programs out there to do random junk instead of wasting cycles.Prime95 - Mersenne Prime finder - Find prime numbers with 10,000,000+ digits.SETI@Home - Search for Extra Terrestrial Intelligence - examine radio broadcasts received from the Arecibo thingy in Puerto Rico (I think).Those are the two I used to do, but it's been a while. Anyway, 17% is nothing while you're asleep. Those were using 50% or more and up to like... 200 mb of RAM. Good times. Link to comment Share on other sites More sharing options...
Valuater Posted January 16, 2006 Share Posted January 16, 2006 (edited) or maybe expandcollapse popup#include <Date.au3> #include <Array.au3> Const $tickhour = 60 * 60 * 1000 Const $tickmin = 60 * 1000 Global $int = $tickhour Global $alarm = '' If Not FileExists('alarmconfig.ini') Then Create_ini() While 1 $alarmini = IniReadSectionNames( 'alarmconfig.ini') For $x = 1 To 7 If $alarmini[$x] = @WDAY Then $alarm = IniRead( 'alarmconfig.ini', $x, "1", "") $inta = $tickhour; not sure ExitLoop EndIf $alarm = '' Next If $alarm <> '' Then Local $hour = StringLeft($alarm, 2) Local $min = StringRight($alarm, 2) Local $sec = 0 Local $CurrentTick = _TimeToTicks(@HOUR, @MIN, @SEC) Local $endTick = _TimeToTicks($hour, $min, $sec) Local $ticktill = $endTick - $CurrentTick If $ticktill < $tickhour Then $inta = $tickmin * 30;if within an hour then poll every 30 min If $ticktill < $tickmin * 30 Then $inta = $tickmin * 5;if within 30 min poll every 5 min If $ticktill < $tickmin * 5 Then $inta = $tickmin; if within 5 min poll every min If $ticktill < $tickmin Then $inta = 1000; if within a min then poll every second If $ticktill < 1001 And $ticktill > 0 Then $inta = _alarm(); if within a second then set off the alarm EndIf $int = $inta Sleep($int) WEnd ; -------------------- Functions ----------------------------- Func Create_ini() IniWrite('alarmconfig.ini', '1', '1', ''); Sunday IniWrite('alarmconfig.ini', '2', '1', '') IniWrite('alarmconfig.ini', '3', '1', '') IniWrite('alarmconfig.ini', '4', '1', '') IniWrite('alarmconfig.ini', '5', '1', '') IniWrite('alarmconfig.ini', '6', '1', '') IniWrite('alarmconfig.ini', '7', '1', ''); Saturday EndFunc;==>Create_ini Func _alarm() Run(@ProgramFilesDir & '\winamp\winamp.exe') ProcessWait("winamp.exe") SoundSetWaveVolume(15) Run('CLAmp.exe /VOLSET 26 /PLAY') Return ($tickmin - 1000) EndFunc;==>_alarm ********** NOT TESTED *************** 8) EDIT Globalized $alarm and added into for/next loop with "" Edited January 16, 2006 by Valuater Link to comment Share on other sites More sharing options...
Swimming_Bird Posted January 17, 2006 Author Share Posted January 17, 2006 (edited) Had you thought about instead of making it a While Loop just making it a function... That way you could do: *sniphrm i'll give this shot but i'll set the time to $int. anyone know if there is a more efficent way to make an alarm? ideally i'd like to make this exe a service that would constantly run. EDIT: The strange thing is before i formatted it ran fine. using hardly any resources. Edited January 17, 2006 by Swimming_BIrd Link to comment Share on other sites More sharing options...
Swimming_Bird Posted January 17, 2006 Author Share Posted January 17, 2006 hrm, no matter the time interval i put in for AdlibEnable it quits out very fast.>"C:\Program Files\AutoIt3\SciTE\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "C:\Documents and Settings\Tal\My Documents\Scripts\Alarm\Alarm.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams >Running: (3.1.1.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Tal\My Documents\Scripts\Alarm\Alarm.au3" >AutoIT3.exe ended.>Exit code: 0 Time: 0.823 Link to comment Share on other sites More sharing options...
greenmachine Posted January 17, 2006 Share Posted January 17, 2006 Hmm, that looks familiar... the first line says /beta, and the folder is autoit3/beta, but when it runs it's in 3.1.1.0 (not beta). There also aren't any quotes around the c:\program files\... on the running: line. Check your C:\ drive for a file called "program" with no extension. If it's there, delete it. It's nothing. That is what happened to me a while back (not sure why). Link to comment Share on other sites More sharing options...
Swimming_Bird Posted January 17, 2006 Author Share Posted January 17, 2006 thats just the command line output from SciTE. same issue when i run it outside of scite. Link to comment Share on other sites More sharing options...
greenmachine Posted January 17, 2006 Share Posted January 17, 2006 Yes I know that's just the output. Did you check anyway? Link to comment Share on other sites More sharing options...
Swimming_Bird Posted January 17, 2006 Author Share Posted January 17, 2006 Hrm it appears as though it's constantaly setting int to whatever this line defines it as: If $ticktill < $tickmin Then $inta[$n]=1000; if within a min then poll every second Link to comment Share on other sites More sharing options...
Swimming_Bird Posted January 17, 2006 Author Share Posted January 17, 2006 (edited) Mystery SOLVEDIt turns out that if i was ever past the alarm point it would set the $int to the lowest variable.So i just changed it to this:If $ticktill < $tickhour And $ticktill > 0 Then $inta[$n]=$tickmin * 30;if within an hour then poll every 30 min ElseIf $ticktill < $tickmin*30 And $ticktill > 0 Then $inta[$n]=$tickmin * 5;if within 30 min poll every 5 min ElseIf $ticktill < $tickmin*5 And $ticktill > 0 Then $inta[$n]=$tickmin; if within 5 min poll every min ElseIf $ticktill < $tickmin And $ticktill > 0 Then $inta[$n]=1000; if within a min then poll every second ElseIf $ticktill < 1001 And $ticktill > 0 Then $inta[$n]=_alarm(); if within a second then set off the alarm ElseIf $ticktill < 0 Then $inta[$n]=$tickhour ElseIf $CurrentTick > $tickhour * 23 And $inta[$n] > $tickhour Then $int[$n]=($tickhour*24)-$CurrentTick;if almost the nextday sets it up to poll at the beginning of the day EndIfIf anyone wants this whole script including the clamp exe lemme know. Edited January 17, 2006 by Swimming_BIrd Link to comment Share on other sites More sharing options...
Oxin8 Posted January 17, 2006 Share Posted January 17, 2006 just out of curiousity, is the clamp.exe playing, pausing, etc? for my script, i just used controlsend with the winamp hotkeys. i'm not sure if you'd rather do it that way but i'd just thought i'd share. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
greenmachine Posted January 17, 2006 Share Posted January 17, 2006 Good job Sherlock Holmes! Link to comment Share on other sites More sharing options...
Swimming_Bird Posted January 17, 2006 Author Share Posted January 17, 2006 (edited) expandcollapse popupProgram Control START ............ Start Winamp QUIT ............ Exit Winamp Note : any following option will automatically start winamp if necessary - No need to use /START as first option. General Control PLAY ............ Play (current file) - Quits Stopped or Pause mode STOP ............ Stop playing STOPFADE ............ Stop playing with fadout STOPAFTER ............ Stop playing after current track (returns now, stops later) PAUSE ............ Toggle pause mode PLAYPAUSE ............ Same as above NEXT ............ Play next song PREV ............ Play previous song FWD ............ Forward 5 seconds FORWARD ............ Same as above REW ............ Rewind 5 seconds REWIND ............ Same as above RESTART ............ Restart current track from beginning (not working with Winamp 2) New Winamp Modes REPEAT ............ Toggle Repeat mode SWREPEAT ............ Same as above REPEAT ON ............ Set Repeat mode ON REPEAT=1 ............ Same as above REPEAT OFF ............ Set Repeat mode OFF REPEAT=0 ............ Same as above RANDOM ............ Toggle Random mode RANDOM ON ............ Set Random mode ON RANDOM=1 ............ Same as above RANDOM OFF ............ Set Random mode OFF RANDOM=0 ............ Same as above PlayList Control PLADD <file> ............ Add file(s) to end of playlist (like drag-n-drop) LOAD <file> ............ Same as above PLCLEAR ............ Clear Playlist CLEAR ............ Same as above PL ............ Show/Hide Winamp Playlist window PLWIN ............ Same as above PLPOS ............ Query Playlist position PLFIRST ............ Play first item of playlist New PLLAST ............ Play last item of playlist New Volume Control VOLUP ............ Volume up VOLDN ............ Volume down VOLSET <value> ............ Volume set (scale 0-255) VOLMAX ............ Volume max VOLMIN ............ Volume min (mute) Infos POS ............ Query current position in file and track length POSITION ............ Query current position in file only STATE ............ Query current state (PLAYING;PAUSED;STOPPED;NOT RUNNING) STATUS ............ Synonym for STATE TITLE ............ Query current track title VER ............ Query Winamp version Winamp Interactive Windows ABOUT ............ Display Winamp About window PREFS ............ Display Winamp Preferences window OPEN ............ Display Winamp Open File window Equalizer Control EQWIN ............ Toggle Eq window (Works with Classic skins only) EQINFO ............ Query Eq parameters (10 bands, Preamp, Status, Autoload) EQSET <parms> ............ Set Eq parameters (Same format as EQINFO) EQSTATUS ............ Toggle Eq status (ON / OFF) EQSTATUS ON ............ Set Eq status ON EQSTATUS OFF ............ Set Eq status OFF Winamp Display ONTOP ............ Toggle Always On Top option MAINWIN ............ Toggle Main Window (Show / Hide) MINIMIZE ............ Minimize Winamp Misc CDPLAY ............ Play CD New Examples CLAMP /PLAY CLAMP /PLCLEAR /PLADD "MySong1.mp3" /PLADD "MySong2.mp3" /PLAY Edited January 17, 2006 by Swimming_BIrd Link to comment Share on other sites More sharing options...
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