Hi All,
I am pretty new to this and still learning so please take it easy..![:)]()
I am writing a small script to jiggle the mouse (always so that the screen does not lock)
and then execute a few functions such as sending keys and starting batch scripts..
I am struggling as I seem to be stuck in a loop and cant work out how to do things differently. I have included the code below..
if anyone could offer me any advice it would be much appreciated.. Thanks in advance Steve
I am pretty new to this and still learning so please take it easy..
![:)](http://aut1.autoit-cdn.com/forum/public/style_emoticons/default/smile.png)
I am writing a small script to jiggle the mouse (always so that the screen does not lock)
and then execute a few functions such as sending keys and starting batch scripts..
I am struggling as I seem to be stuck in a loop and cant work out how to do things differently. I have included the code below..
AutoIt
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 143, 178, 192, 124) $JiggleMouseCB = GUICtrlCreateCheckbox("Jiggle Mouse", 24, 48, 97, 17) $SendKeysCB = GUICtrlCreateCheckbox("SendKeys", 24, 72, 97, 17) $RunBT = GUICtrlCreateButton("RunBT", 32, 112, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Func ReadInputs() Global $sendkeysCBVar = GUICtrlRead($SendKeysCB) Global $JiggleMouseCBVar = GUICtrlRead($JiggleMouseCB) EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $RunBT Call("ReadInputs") Call("Processes") EndSwitch WEnd Func Processes() ; The mouse jiggler works but i get stuck in this loop and cannot do the next operation if $JiggleMouseCBVar = 1 then call ("mouseJigllo") EndIf if $sendkeysCBVar = 1 then call ("sendkeys") EndIf EndFunc Func mouseJigllo() While 1 ; something about this breaks the script I think it is because it is an infinite loop and in order to shut down the script its process has to be ended $Checked = GUICtrlRead($JiggleMouseCB) If $Checked = 1 Then Sleep (10000) MouseMove(50, 50, 100) MouseMove(80, 60, 100) ElseIf $Checked<>1 Then Sleep(10000) EndIf WEnd EndFunc Func SendKeys() WinActivate("LDEP") WinWait("", "", 10) Send("!f") WinWait("", "", 10) Send("p") WinWait("", "", 10) EndFunc