Jaco114 Posted June 27, 2019 Share Posted June 27, 2019 Hi! How to make PixelSearch look for the pixel from the center of the screen? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 27, 2019 Moderators Share Posted June 27, 2019 Jaco114, Use the @DesktopHeight/Width macros to determine the screen size - plus a little maths to get the centre pixel location. 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 Link to comment Share on other sites More sharing options...
Jaco114 Posted June 27, 2019 Author Share Posted June 27, 2019 (edited) Is it possible to set it to search for the nearest pixel around cursor? Edited June 27, 2019 by Jaco114 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 27, 2019 Moderators Share Posted June 27, 2019 Jaco114, Use MouseGetPos to get the current cursor location. 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 Link to comment Share on other sites More sharing options...
Jaco114 Posted June 27, 2019 Author Share Posted June 27, 2019 $cords = PixelSearch(267,146,1004,641,0x91D0C3,5) if not (@error) Then MouseClick("left",$cords[0],$cords[1],2) What I need to change in code to search the nearest pixel around the cursor? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 27, 2019 Moderators Share Posted June 27, 2019 Jaco114, Look in the Help file for the return values from MouseGetPos (hint: they are in an array) and then use those values in place of the current coordinates in your PixelSearch call. 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 Link to comment Share on other sites More sharing options...
Jaco114 Posted June 27, 2019 Author Share Posted June 27, 2019 $aPos = MouseGetPos() $cords = PixelSearch($aPos[0],$aPos[1],1004,641,0x91D0C3,5) if not (@error) Then MouseClick("left",$cords[0],$cords[1],2) What i need to write instead 1004 and 641? MouseGetPos can only get 1 x and y. I got interested in autoit a few days ago and I do not know too much. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 27, 2019 Developers Share Posted June 27, 2019 5 minutes ago, Jaco114 said: I got interested in autoit a few days ago and I do not know too much. The problem just is that you seem to still try to automate that game. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
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