monte Posted February 23, 2008 Share Posted February 23, 2008 Hello, my script is consuming all my cpu cycles and slowing down my computer. It makes sure my thunderbird email client is running and in the system tray if someone tries to close it. Any ideas? #notrayicon while 1 If not ProcessExists("thunderbird.exe") Then Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe") WinWait("Inbox for") winactivate("Inbox for") Send("^+m") endif wend Link to comment Share on other sites More sharing options...
Tomb Posted February 23, 2008 Share Posted February 23, 2008 Hello, my script is consuming all my cpu cycles and slowing down my computer. It makes sure my thunderbird email client is running and in the system tray if someone tries to close it. Any ideas? #notrayicon while 1 If not ProcessExists("thunderbird.exe") Then Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe") WinWait("Inbox for") winactivate("Inbox for") Send("^+m") endif wend well first off, I really don't like using the "not" thing, so I made it this way. but also maybe a sleep timer. #notrayicon while 1 sleep(1000) If ProcessExists("thunderbird.exe") Then Exit Else Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe") WinWait("Inbox for") winactivate("Inbox for") Send("^+m") EndIf WEnd Link to comment Share on other sites More sharing options...
Developers Jos Posted February 23, 2008 Developers Share Posted February 23, 2008 well first off, I really don't like using the "not" thing, so I made it this way. but also maybe a sleep timer.The NOT thing as you call it is fine to use and a sleep(10) is probably enough to give other processes some time as well... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Anteaus Posted February 23, 2008 Share Posted February 23, 2008 The NOT thing as you call it is fine to use and a sleep(10) is probably enough to give other processes some time as well...You could probably add a sleep(250) to the loop without it seriously impacting script performance, and that should take your processor usage down to single figures. Or, while Thuunderbird isn't running you could introduce a longer delay betweem checks, and make it say 25ms while it is running. Link to comment Share on other sites More sharing options...
Tomb Posted February 23, 2008 Share Posted February 23, 2008 The NOT thing as you call it is fine to use and a sleep(10) is probably enough to give other processes some time as well...yeah its fine I just don't like it. Usually a While loop needs a sleep, if not it just keeps doing the function so fast, its kind of silly. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 24, 2008 Developers Share Posted February 24, 2008 (edited) yeah its fine I just don't like it.Its fine when you don't like it but you made it sound like its something to avoid which I don't agee with.Usually a While loop needs a sleep, if not it just keeps doing the function so fast, its kind of silly.I specified the Sleep(10) since that is the default also used by the GUIGetMsg() for example, which is used in a loop a lot. Edited February 24, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tomb Posted February 24, 2008 Share Posted February 24, 2008 Its fine when you don't like it but you made it sound like its something to avoid which I don't agee with. I specified the Sleep(10) since that is the default also used by the GUIGetMsg() for example, which is used in a loop a lot. i would avoid it personally. i would in all cases prefer a nice If and Else and EndIf Link to comment Share on other sites More sharing options...
MHz Posted February 24, 2008 Share Posted February 24, 2008 i would avoid it personally. i would in all cases prefer a nice If and Else and EndIfThat sounds nice . But you changed the conditions to make things look nice . You added "Exit" into the condition when the user did not have it to begin with so perhaps you should learn to use "Not" to be look nice to suit the conditions needed ? Link to comment Share on other sites More sharing options...
Tomb Posted February 24, 2008 Share Posted February 24, 2008 That sounds nice . But you changed the conditions to make things look nice . You added "Exit" into the condition when the user did not have it to begin with so perhaps you should learn to use "Not" to be look nice to suit the conditions needed ?the exit was just my addition, easy enough toedit it out and instead say sleep(0) would he really want it constantly running>? i imagined he would want it to run once and done. everytime you close it there it is again who wants that?> if he does then he can take it out Link to comment Share on other sites More sharing options...
MHz Posted February 24, 2008 Share Posted February 24, 2008 (edited) the exit was just my addition, easy enough toedit it out and instead say sleep(0) would he really want it constantly running>? i imagined he would want it to run once and done. everytime you close it there it is again who wants that?> if he does then he can take it outSo you think that looks better then using Not? Please stop doing this to yourself. Edited February 24, 2008 by MHz Link to comment Share on other sites More sharing options...
Tomb Posted February 24, 2008 Share Posted February 24, 2008 So you think that looks better then using Not? Please stop doing this to yourself. ofc 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