Sign in to follow this  
Followers 0
moejo

MouseGetPos()

11 posts in this topic

What I have been trying to do is try to make a program where the gui will show the Mouse's position. This is kinda like what AutoIt Window info program does. Anyone knows the script in doing this?

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Check out GUIGetCursorInfo in the helpfile.

Edit : Ooh. Did you mean that you want to show the numbers returned from

MouseGetPos in a GUI ? If so, just create a GUI, a label (or whatever) and put

the data there with GUICtrlSetData. Check out some GUI-examples if you're

new with GUIs.

Edited by Helge

Share this post


Link to post
Share on other sites

Edit : Ooh. Did you mean that you want to show the numbers returned from

MouseGetPos in a GUI ? If so, just create a GUI, a label (or whatever) and put

the data there with GUICtrlSetData. Check out some GUI-examples if you're

new with GUIs.

Yup, anyway, is it something like this?

$pos = MouseGetPos()

GUICtrlSetData ( -1, $pos[0],$pos[1] )

Share this post


Link to post
Share on other sites

Get rid of the 2nd comma and you maybe close. GuiCtrlSetData usually uses 2 parameters. :whistle:

Share this post


Link to post
Share on other sites

Get rid of the 2nd comma and you maybe close. GuiCtrlSetData usually uses 2 parameters. :whistle:

Yargg! did that and an error showed up :S

GuiCtrlSetData (-1,$pos[0]$pos[1])

GuiCtrlSetData(-1,^Error

Error:Error in Expression

Share this post


Link to post
Share on other sites

If IsArray($pos) Then


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Try $pos[0] & ', ' & $pos[1]. That would be like '45, 300' or whatever values.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

If IsArray($pos) Then

If you read the error-message then you will see that that's not the problem in his case.

Not the use of the &'s.

GuiCtrlSetData (-1,$pos[0] & "x" & $pos[1])

Edit : Icekirby1 beat me to it. Multi-tasking isn't working very well for me :whistle:

Edited by Helge

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

$Window = GUiCreate("Mouse Position", 300, 50)
$label1 = GUiCtrlCreateLabel("Current Mouse Position = ", 10, 10, 280, 30)
GUiSetState()

While 1
$pos = MouseGetPos()

GUiCtrlSetData($label1, ("Current Mouse Position = "& $pos[0] &", "&$pos[1]);Sorry if wrong syntax(In a hotel computer, Only one window allowed open at a time)
Wend

Share this post


Link to post
Share on other sites

Thanks for all your replys, i know have mouse position to work :whistle:

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  
Followers 0