dersiniar Posted December 26, 2018 Posted December 26, 2018 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 Melba23 Posted December 26, 2018 Moderators Posted December 26, 2018 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now