Sign in to follow this  
Followers 0
TokeySmurf

Sorry, Still having trouble with mouse coords

12 posts in this topic

here is what I got. I know its all probably backwords been working on it awhile now just trying diffrent things, Someone suggested tooltip said thats what I went with.. having problems with syntaxx.

Func mcoord()
            $pos = MouseGetPos()
            $mpos = ToolTip("")
            GUICtrlSetData($mpos, $pos "")
sleep(200)

EndFunc

Thanks for help

-Tokey

Share this post


Link to post
Share on other sites



here is what I got. I know its all probably backwords been working on it awhile now just trying diffrent things, Someone suggested tooltip said thats what I went with.. having problems with syntaxx.

Func mcoord()
            $pos = MouseGetPos()
            $mpos = ToolTip("")
            GUICtrlSetData($mpos, $pos "")
sleep(200)

EndFunc         

oÝ÷ Ù8ZK¢¸^è쿪ê-{T­É-¢Ø^¶br̨¹ÊÞjרØ^²æãyËn®
See anything different other than variable names and the fact that I'm using a msgbox?

[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

#3 ·  Posted (edited)

mousepos return an array:

$MousePos = MouseGetPos()

$MousePosX = $MousePos[0]

$MousePosY = $MousePos[1]

Edited by ramadash

Share this post


Link to post
Share on other sites

I'm not much of one for copying and pasting so if perhaps you could hint me towards a help doc or just a little more explaniation if you could sorry, I'm really new to this. Just been doing alot of reading and going from there heh

Share this post


Link to post
Share on other sites

I'm not much of one for copying and pasting

You just mean you'd rather learn it the hard way by reading help files that way you understand what you are using in your script? Me too.

- Dan [Website]

Share this post


Link to post
Share on other sites

I'm not much of one for copying and pasting so if perhaps you could hint me towards a help doc or just a little more explaniation if you could sorry, I'm really new to this. Just been doing alot of reading and going from there heh

I think the explination in the help file explains it all:

Returns a two-element array that containing the mouse coordinates: $array[0] = X coord (horizontal), $array[1] = Y coord (vertical)

Look under return values to see things like this.

[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

here is what I got. I know its all probably backwords been working on it awhile now just trying diffrent things, Someone suggested tooltip said thats what I went with.. having problems with syntaxx.

Func mcoord()
            $pos = MouseGetPos()
            $mpos = ToolTip("")
            GUICtrlSetData($mpos, $pos "")
sleep(200)

EndFunc         

oÝ÷ Ù8ZK¢¸^è쿪ê-y8^~éܶ*'º¹oÝ÷ Ø è¶«¶§êå

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks alot everyone, That did help me understand more, sometimes I can look at the help file and understand it, other times its like ahhh hehe.. I'm going to play with arrays and Yea I see that return thing now in the help file, hmm.. Thanks again. How am I ever going to get it to record if I can't do mousepos on my own!! hehe :)

Share this post


Link to post
Share on other sites

Ok, I now understand how you guys did it (claps) ha :) And what was really throwing me off was like the line break commands ( just looked confusing) =).. But now I'm still having trouble of geting it to update in realtime , Like Puting it into a msg box and The coords display in that box as you move the mouse, The tooltip worked pretty good but it was just creating the tooltip over an over and caused some cursor lag.

I've tried puting it into the while loops but I find it just then creates the msgbox over and over. I've tried a couple diffrent things like guictrlsetdata etc.. But nothing seems to work, yea it displays or it gets caught in an infinite loop if you click the ok button it just re-displays and gives you the coords of the OK button (ouch)

Thanks for help

-Tokey

Share this post


Link to post
Share on other sites

Ok, I now understand how you guys did it (claps) ha :P And what was really throwing me off was like the line break commands ( just looked confusing) =).. But now I'm still having trouble of geting it to update in realtime , Like Puting it into a msg box and The coords display in that box as you move the mouse, The tooltip worked pretty good but it was just creating the tooltip over an over and caused some cursor lag.

I've tried puting it into the while loops but I find it just then creates the msgbox over and over. I've tried a couple diffrent things like guictrlsetdata etc.. But nothing seems to work, yea it displays or it gets caught in an infinite loop if you click the ok button it just re-displays and gives you the coords of the OK button (ouch)

Thanks for help

-Tokey

Two possible options: Change the message to a TrayTip() so it won't follow the mousepointer around:

For $n = 1 To 60
     $XCoord = MouseGetPos(0)
     $YCoord = MouseGetPos(1)
     TrayTip("Result",  "X = " & $XCoord & @LF & "Y = " & $YCoord, 30)
     Sleep(500)
Next

Or, you can create a custom GUI and update its position to follow the mousepointer (or whatever you want it to do). This option involves much more code and more new concepts, but will be highly customizable -- not the first thing I would recommend for one of your first scripts, but if you want to give it a try, start with tutorials for GUIs, like in Valuater's AutoIT 1-2-3 (link in my sig below).

As always, don't be afraid to post your broken code and get help with it.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Two possible options: Change the message to a TrayTip() so it won't follow the mousepointer around:

For $n = 1 To 60
     $XCoord = MouseGetPos(0)
     $YCoord = MouseGetPos(1)
     TrayTip("Result",  "X = " & $XCoord & @LF & "Y = " & $YCoord, 30)
     Sleep(500)
Next

Or, you can create a custom GUI and update its position to follow the mousepointer (or whatever you want it to do). This option involves much more code and more new concepts, but will be highly customizable -- not the first thing I would recommend for one of your first scripts, but if you want to give it a try, start with tutorials for GUIs, like in Valuater's AutoIT 1-2-3 (link in my sig below).

As always, don't be afraid to post your broken code and get help with it.

:)

That code helped me out, thanks.

Share this post


Link to post
Share on other sites

That code helped me out, thanks.

Just a point taken from the help file, but you're welcome. :)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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