Jump to content

Recommended Posts

Posted

I have 4 GUI controls on my GUI, which are coordinates

$Left = GUICtrlCreateEdit("", 50, 35, 40, 20, $WS_TABSTOP) ; Coords

$Top = GUICtrlCreateEdit("", 150, 35, 40, 20, $WS_TABSTOP) ; Coords

$Right = GUICtrlCreateEdit("", 50, 85, 40, 20, $WS_TABSTOP) ; Coords

$Bottom = GUICtrlCreateEdit("", 150, 85, 40, 20, $WS_TABSTOP) ; Coords

Further on I want to indicate these coordinates on screen with:

MouseMove($Left, $Top)

MouseMove($Right, $Top)

MouseMove($Right, $Bottom)

MouseMove($Left, $Bottom)

Does'nt work ?

Cursor just goes to 0,0 of the scren and sits there ?!?

Posted

Hello TJsmart,

First, Welcome to the AutoIt Forums.

first off MouseMove() only needs 2 coords, and trying to input 2 functions into the coords is just broken all over!

A Working Example of Correct Variables and MouseMove() Function

$Width = 100
$Height = 50

MouseMove($Width,$Height)

Realm

P.S. The Help File is very resourceful for learning AutoIt

Another good place to learn is this tutorial #145357

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Posted

Hello TJsmart,

First, Welcome to the AutoIt Forums.

first off MouseMove() only needs 2 coords, and trying to input 2 functions into the coords is just broken all over!

A Working Example of Correct Variables and MouseMove() Function

$Width = 100
$Height = 50

MouseMove($Width,$Height)

Realm

P.S. The Help File is very resourceful for learning AutoIt

Another good place to learn is this tutorial #145357

Hey, and thanks...

I still don't get it, the controls only holds one value each?

Like

$Left = 100

$Top = 200

$Bottom = 300

$Right = 400

I just input it from the GUI rather than from a variable...

Posted (edited)

Hello TJsmart,

I am not sure we are on the same page, you really should start by reading the Tutorials in the Help File along with the tutorial application which I provided a link for in my previous post. These items will better help you understand the the actual references to variables, controls and so on.

$Left, $Top, $Bottom, $Right are called variables.

GUICtrlCreateEdit() is a function that creates a control in your GUI.

Variables hold different Data Types.

If your MouseMove() funtion is always going to have constant coords, you can input the numbers directly Example:

MouseMove(1,1).

However if there is a possibility this area may be found at a different point, than you can assign variables, which could be change by another function. Example:

#include <WindowsConstants.au3>

Opt('MouseCoordMode', 2)
Local $x, $y

$myGUI = GUICreate("My GUI")
$edit_TopLeft = GUICtrlCreateEdit("", 50, 35, 40, 20, $WS_TABSTOP) ; Coords
$edit_TopRight = GUICtrlCreateEdit("", 150, 35, 40, 20, $WS_TABSTOP) ; Coords
$edit_BottonLeft = GUICtrlCreateEdit("", 50, 85, 40, 20, $WS_TABSTOP) ; Coords
$edit_BottomRight = GUICtrlCreateEdit("", 150, 85, 40, 20, $WS_TABSTOP) ; Coords
GUISetState()

While 1
    $select = InputBox('Show Me the Control','Enter the number of the control you wish to point to?' & @CRLF & @CRLF _
            & ' 1 = Top Left ' & @CRLF _
            & ' 2 = Top Right ' & @CRLF _
            & ' 3 = Bottom Left ' & @CRLF _
            & ' 4 = Bottom Right ','','',250,200,0,0,30)

    Switch $select
        Case 1
            $x = 70
            $y = 45
        Case 2
            $x = 170
            $y = 45
        Case 3
            $x = 70
            $y = 95
        Case 4
            $x = 170
            $y = 95
        Case Else
            ExitLoop
    EndSwitch
    MouseMove($x,$y)
    Sleep(2000)
WEnd
GUIDelete()
Exit

I used your example to create this script example. Also I manually entered the coords into the Switch, by locating a center point from the coords provided in your example.

I hope this helps you more ;)

Realm

Edit: Fixed Font Size, for some reason, it was changed to a much larger font making this post, just to large.

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

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
×
×
  • Create New...