Jump to content

Recommended Posts

Posted

Hi all!

I need your helps! I would like to post on a GUI surface the mouse coordinates to input fields and i want them to change when I move the cursor.

Could someone help me?

$pos = MouseGetPos()
        GUICtrlCreateLabel("Mouse coord.:", 300, 5)
        GUICtrlCreateLabel("X:", 300, 20)
        GUICtrlCreateLabel("Y:", 350, 20)
        GUICtrlCreateInput($pos[0],275,35, 40, 20)
        GUICtrlCreateInput($pos[1],335,35, 40, 20)

It isn't working well because it is just show the position of the mouse at one time.

Thx!

Wath

Posted

GUICtrlCreateLabel("Mouse coord.:", 300, 5)
GUICtrlCreateLabel("X:", 300, 20)
GUICtrlCreateLabel("Y:", 350, 20)
$X = GUICtrlCreateInput($pos[0], 275, 35, 40, 20)
$y = GUICtrlCreateInput($pos[1], 335, 35, 40, 20)
While 1
    $pos = MouseGetPos()
    GUICtrlSetData($X, $pos[0])
    GUICtrlSetData($y, $pos[0])
    Sleep(10)
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

GUICtrlCreateLabel("Mouse coord.:", 300, 5)
GUICtrlCreateLabel("X:", 300, 20)
GUICtrlCreateLabel("Y:", 350, 20)
$X = GUICtrlCreateInput($pos[0], 275, 35, 40, 20)
$y = GUICtrlCreateInput($pos[1], 335, 35, 40, 20)
While 1
    $pos = MouseGetPos()
    GUICtrlSetData($X, $pos[0])
    GUICtrlSetData($y, $pos[0])
    Sleep(10)
WEnd

Hi!

I got the folowing error.

$X = GUICtrlCreateInput($pos[0],275,35,40,20)

$X = GUICtrlCreateInput($pos^ERROR

Error: Subscript used with non-Array variable.

I tried to put the while statement before the input fields but it was made unfinished loop.

Posted (edited)

Try declaring $pos[2] before the whole script

EDIT:

Local $pos[2]

$test = GUICreate("test")
GUICtrlCreateLabel("Mouse coord.:", 300, 5)
GUICtrlCreateLabel("X:", 300, 20)
GUICtrlCreateLabel("Y:", 350, 20)
$X = GUICtrlCreateInput($pos[0], 275, 35, 40, 20)
$y = GUICtrlCreateInput($pos[1], 335, 35, 40, 20)
GUISetState(@SW_SHOW, $test)

While 1
    $pos = MouseGetPos()
    GUICtrlSetData($X, $pos[0])
    GUICtrlSetData($y, $pos[1])
    Sleep(10)
WEnd

This works fine for me

Edited by AoRaToS

s!mpL3 LAN Messenger

Current version 2.9.9.1 [04/07/2019]

s!mpL3 LAN Messenger.zip

s!mpL3

Posted

Hi!

I got the folowing error.

$X = GUICtrlCreateInput($pos[0],275,35,40,20)

$X = GUICtrlCreateInput($pos^ERROR

Error: Subscript used with non-Array variable.

I tried to put the while statement before the input fields but it was made unfinished loop.

Ahh yeah now it's working well.

Thx for the fast help!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...