Jump to content
Sign in to follow this  

_GUICtrlButton_GetState Problems with structuring button clicks!

Recommended Posts

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


Share this post

Link to post
Share on other sites

Here's the script:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <GuiButton.au3>


Func Mover() ; Creates the GUI and shows it

    GUICreate ("Jiggler", 300, 100)
    Global $idinput1 = GUICtrlCreateInput("", 20, 20, 20, 20)
    Global $idbuttn1 = GUICtrlCreateButton("Jiggle!", 50, 50,50,50)



Func jiggle()
    $vmin = GUICtrlRead ($idinput1)

    $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


Func Time()

While 1

;$vmin = 0
    Switch GUIGetMsg()
       Case $idbuttn1

Edited by saxbonsai

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...