LOOP problem can't exit
#21
Posted 13 April 2012 - 08:33 PM
@OP: Your english grammar went from decent to almost not understandable in 9 mins flat. First the script was for you and now it is for other "users."
Yeah. To each their own I will write this off as since this is not about how to push updates of unknown content to clients in a domain.
@EndFunc: I have screensaver locks disabled in remote sessions.
#22
Posted 13 April 2012 - 08:35 PM
It shouldn't have gone past 3-4 posts..
Edited by ApudAngelorum, 13 April 2012 - 08:35 PM.
#23
Posted 13 April 2012 - 08:39 PM
this is one of the early scripts I made and still use today
I have a machine I don't want to lock (and can't change the setting) so I have this script running 24/7 and works wonderfully.
Since the mouse only moves just enough to keep the pc from locking, it doesn't interfere with other stuff you are doing.
Why not just put your script and his together? Try this...?thank you tho share you script it will work, but i will not the only one to use this script and its why i want a GUI to start and stop the script
(sorry for my bad english)
#include <GUIConstantsEx.au3> _Main() Func _Main() Local $filemenu, $fileitem, $recentfilesmenu Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton Local $msg, $file GUICreate("AntiSleep Script", 300, 150) $filemenu = GUICtrlCreateMenu("File") $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $helpmenu = GUICtrlCreateMenu("?") $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) $okbutton = GUICtrlCreateButton("Start the AntiSleep Script", 50, 10, 200, 40) $cancelbutton = GUICtrlCreateButton("Stop", 50, 60, 200, 40) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton ExitLoop Case $msg = $exititem ExitLoop Case $msg = $okbutton do $pos = MouseGetPos() $x = $pos[0] $y = $pos[1] If $x<1023/2 And $y<767/2 Then MouseMove($x + 5,$y + 5) If $x>1023/2 And $y>767/2 Then MouseMove($x - 5,$y - 5) If $x<1023/2 And $y>767/2 Then MouseMove($x + 5,$y - 5) If $x>1023/2 And $y<767/2 Then MouseMove($x - 5,$y + 5) Sleep(300000) until $msg = $cancelbutton Exit Case $msg = $aboutitem MsgBox(0, "About", "This Script was created by Eric Boudreau") EndSelect WEnd GUIDelete() Exit EndFunc ;==>_Main
Not tested...
Edited by EndFunc, 13 April 2012 - 08:41 PM.
#24
Posted 13 April 2012 - 09:25 PM
.
#include <GUIConstantsEx.au3> _Main() Func _Main() Local $filemenu, $fileitem, $recentfilesmenu Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton Local $msg, $file GUICreate("AntiSleep Script", 300, 150) $filemenu = GUICtrlCreateMenu("File") $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $helpmenu = GUICtrlCreateMenu("?") $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) $okbutton = GUICtrlCreateButton("Start the AntiSleep Script", 50, 10, 200, 40) $cancelbutton = GUICtrlCreateButton("Stop", 50, 60, 200, 40) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $exititem ExitLoop Case $msg = $aboutitem MsgBox(0, "About", "This Script was created by Eric Boudreau") Case $msg = $okbutton ; this is where my problem start $IStart = 0 While 1 $msg = GUIGetMsg() $iTimeDiff = TimerDiff($IStart) If $iTimeDiff > 8000 Then MouseMove(600, 900) $IStart = TimerInit() ElseIf $iTimeDiff > 4000 And $iTimeDiff < 4010 Then MouseMove(800, 900) ElseIf $msg = $cancelbutton Then ExitLoop EndIf WEnd EndSelect WEnd ;GUIDelete() ;Exit EndFunc ;==>_Main
Edited by czardas, 13 April 2012 - 09:44 PM.
#26
Posted 13 April 2012 - 09:48 PM
Sort of. I just edited the code a little. It should be working now. It's not the only possible solution.have you the solution czardas??
One of the problems with your first script was the line where it says until $msg = $cancelbutton because $msg was already $okbutton. That would never have changed inside your loop. I also replaced the sleep function with TimerInit and TimerDiff. I have found that using sleep makes GUIs unresponsive.
There is a 10 millisecond window in the following line.
You can change this to 100 milliseconds if you wish.
Edited by czardas, 13 April 2012 - 10:08 PM.
#27
Posted 13 April 2012 - 11:44 PM
Sort of. I just edited the code a little. It should be working now. It's not the only possible solution.
One of the problems with your first script was the line where it says until $msg = $cancelbutton because $msg was already $okbutton. That would never have changed inside your loop. I also replaced the sleep function with TimerInit and TimerDiff. I have found that using sleep makes GUIs unresponsive.
There is a 10 millisecond window in the following line.
You can change this to 100 milliseconds if you wish.
Nice one !!! a thousand thanks, i didn't know about the sleep function problem in a GUI. The script run like a charm thank you again
#28
Posted 13 April 2012 - 11:44 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users




