Jump to content

Recommended Posts

Posted

Hi hi,

im a try to make a GUI. Where i can save coordinates and i can get mouseclicks to those coordinates.

here is part 1 where i can save coordinate (it works)

Func _recmouse()
   While 1
      Sleep(200)
If _IsPressed("01") Then
      Sleep(200)
Local $aPos = MouseGetPos()
   Sleep(200)
_WriteToEditBox("Block 1 Saved")
Sleep(200)
      _WriteToEditBox("Select second block")
      _recmouse1()
EndIf
WEnd
EndFunc

and now what i cant get to work is

Func _start()
    If @HotKeyPressed = "{f2}" Then _pause()
 Sleep(200)
 $aPos = MouseClick($MOUSE_CLICK_LEFT)
Sleep(200)

this just makes mouse click to current position my mouse are atm

  • Moderators
Posted

dersiniar,

Welcome to the AutoIt forums.

If you look at the Help file for MouseGetPos, you will see that the default return is an array - with the 2 elements holding the X & Y coordinates. So if you want to get MouseClick to click at those coordinates you need to add them to the function call. In the code above you would need to store the $aPos array as a Global variable so that in can be seen and used in other functions and then extract the separate elements like this:

Func _start()
    If @HotKeyPressed = "{f2}" Then _pause()
    Sleep(200)
    MouseClick($MOUSE_CLICK_LEFT, $apos[0], $aPos[1])
    Sleep(200)

Now MouseClick knows the coordinates where you wish to click the mouse.

But looking at the first snippet it appears you intend to mark more than one point, so you will have to save the coordinates of these multiple points or else you will be continually overwriting the returned position. If that is the case, then I would suggest using another array to hold all of the points, which you can then extract as required.

See what you can produce and come back if you need some more help.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...