Sign in to follow this  
Followers 0
jimmyjoe

Input box for mouse position

3 posts in this topic

I guess Im not wording this right for search engine. I want to make an input box to ask the user to click on a certain spot on their screen and the coords under the mouse be recorded as a variable for other use in the script. This is so screen resolution is no factor in the script. How do I make a func to ask user to click on a named spot on the screen and it record the x/y position asa variable? Newbie question Im sure but that is what I am. Thx in advance.

Share this post


Link to post
Share on other sites



I guess Im not wording this right for search engine. I want to make an input box to ask the user to click on a certain spot on their screen and the coords under the mouse be recorded as a variable for other use in the script. This is so screen resolution is no factor in the script. How do I make a func to ask user to click on a named spot on the screen and it record the x/y position asa variable? Newbie question Im sure but that is what I am. Thx in advance.

This doen't answer your question but maybe do don't need to do that. Look up @DeskTopWidth and @DeskTopHeight.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Here you go, Tested and working completely properly.

#include <Misc.au3>

$Coords = AskUser()

MsgBox(0, "", $Coords[0] & "       " & $Coords[1])


Func AskUser()
    MsgBox(0, "User Input", "Please click the screen on a certain spot" & @CRLF & "Press OK, and then move your mouse there and click")
    Do
        Sleep(50)
    Until _IsPressed(01)
    $Coords = MouseGetPos()
    MsgBox(0, "Thank You", "Your coords have been stored for later use")
    Return $Coords
EndFunc  ;==>AskUser
Edited by Alienware

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