TheCuz Posted February 4, 2005 Share Posted February 4, 2005 While 1 If (@hour = 19) and (@min = 26) Then run ("mslgr.bat") Endif sleep (30000) WEnd For some reason this code takes up 100% of the CPU, any ideas. I have tried putting the sleep command after the Wend, still the same thing. Also, when I use Run ("mslgr.bat" , "c:\"), it comes up the error can not find file. I looked at the help file example and that is what I have, minus on how the window will show. It won't run it unless I launch the EXE from the same directory that the batch file is in. Any feeback would be great. [font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font] Link to comment Share on other sites More sharing options...
phillip123adams Posted February 4, 2005 Share Posted February 4, 2005 (edited) While 1 If (@hour = 19) and (@min = 26) Then run ("mslgr.bat") Endifsleep (30000) WEndFor some reason this code takes up 100% of the CPU, any ideas. I have tried putting the sleep command after the Wend, still the same thing.Also, when I use Run ("mslgr.bat" , "c:\"), it comes up the error can not find file. I looked at the help file example and that is what I have, minus on how the window will show. It won't run it unless I launch the EXE from the same directory that the batch file is in.Any feeback would be great.<{POST_SNAPBACK}>My CPU usage is unaffected by your script. I suspect you are experiencing an issue related to something else.I don't know why the batch file is not found. Is the batch file trying to use a file it can't find? If it's the batch file that is not found,Evidently, Run does not search the the directory of the running script. Since the script is always run from the same directory as the batch file, you could use the macro @ScriptDir to concatenate the path to the batch file name. (although I don't thing this should be necessary).EDIT: The Run test I used was flawed, so I revised my statement Edited February 4, 2005 by phillip123adams Phillip Link to comment Share on other sites More sharing options...
CyberSlug Posted February 4, 2005 Share Posted February 4, 2005 Run("C:\mslgr.bat") Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 4, 2005 Share Posted February 4, 2005 (edited) sometimes the sleep is actually the problem, mess around with the time it sleeps, i dont understand why it uses so much CPU when my alarm clock program uses almost none even when you run it multiple times While 1 If @HOUR = $Hour and @MIN <= $MinE and @MIN >= $MinS Then SoundPlay( $File ) Sleep( $Wait * 1000 ) $QUITAFTER = "YES" EndIf If $QUITAFTER = "YES" Then ExitLoop WEnd EDIT: When running the alarm it skips around at 1-5% CPU that is a lot better than your code, this is weird Edited February 4, 2005 by Xenogis [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
TheCuz Posted February 4, 2005 Author Share Posted February 4, 2005 I'll try to play around with it a little bit and see what I can find out about it. Thanks for the tip CyberSlug, I was just using what was on the example in the help file. I'll post what I find out [font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font] Link to comment Share on other sites More sharing options...
scriptkitty Posted February 5, 2005 Share Posted February 5, 2005 just a side note, I would put in something to make sure it doesn't run the bat file twice, as there are 60 seconds in a minute, and you have it sleep 30 seconds each time.While 1If (@hour = 19) and (@min = 26) Thenrun ("mslgr.bat")Endifsleep (30000)WEndexampleWhile 1 If (@hour = 19) and (@min = 26) Then ;run ("mslgr.bat") sleep(61000); sleep for 61 seconds if time hits Endif sleep (100); my typical wait WEndtest script to determine if autoit, or the bat file is the CPU hog$hour=@hour $min=@min+2 if @min>58 then $min=@min tooltip("going to go off in under 2 minutes",0,0) While 1 If (@hour = $hour) and (@min = $min) Then msgbox(1,"Info", "Time went off",5) tooltip("time found sleeping 61 seconds") sleep(61000); sleep for 61 seconds if time hits tooltip("") Endif sleep (1); my typical wait WEnd AutoIt3, the MACGYVER Pocket Knife for computers. 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