saxbonsai Posted October 6, 2014 Posted October 6, 2014 Hello All, Im brand new here and new to programming. I'm trying to create a script that moves the mouse slightly and back to it's originally location after the user types a value in the input box and clicks the button. The input box parameter is the the variable $vmin which is the pause time in minutes before the mouse moves. The script runs except I can't break out of my Do...Until loop after the first time I click. If I try to click the button again, the input box is ignored. The problem I have is that it doen't break out of my Do loop when I click the button a second time. I'm wondering if it's this statement, Until _GUICtrlButton_GetState($idbuttn1) = $BST_PUSHED Mousemover.au3
saxbonsai Posted October 6, 2014 Author Posted October 6, 2014 (edited) Here's the script: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <GuiButton.au3> Mover() Func Mover() ; Creates the GUI and shows it GUICreate ("Jiggler", 300, 100) GUISetState(@SW_SHOW) Global $idinput1 = GUICtrlCreateInput("", 20, 20, 20, 20) Global $idbuttn1 = GUICtrlCreateButton("Jiggle!", 50, 50,50,50) Time() EndFunc Func jiggle() $vmin = GUICtrlRead ($idinput1) Do $aPos = MouseGetPos() ; Slightly moves the mouse from the current position and back instantly MouseMove ($aPos[0]+3, $aPos[1]+3, 5) MouseMove ($aPos[0]-0, $aPos[1]-0, 5) Sleep(60000*($vmin)); Sleeps for $vmin minutes then returns jiggle and is currently an infinite loop. Until _GUICtrlButton_GetState($idbuttn1) = $BST_PUSHED Time() EndFunc Func Time() While 1 ;$vmin = 0 Switch GUIGetMsg() Case $idbuttn1 jiggle() EndSwitch WEnd EndFunc Edited October 6, 2014 by saxbonsai
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