BitOfHope Posted February 24, 2012 Share Posted February 24, 2012 (edited) Alright, so I've done some googling to try and find my answer, but no luck.I've got a few questions, hopefully they're not to stupid. ;D1. Is it possible to use PixelSearch(or anything else) to lock onto a pixel/area that is located? Example: I search for a specific color and PixelSearch finds it. Is it possible to literally lock onto that pixel? Even if it was moving? I highly doubt that it's possible, but I still feel the need to ask.2. In my previous topic: (For anybody willing to help I won't include my other post in this post to save some space.)I was given some help with dividing the screen in half...So I was wondering if it would be possible to divide the screen up into more sections instead of just half? Maybe 4ths? A dozen? A hundred? Even a thousand?3. Assuming question 2 was possible, and say that the screen was divided into 100 even sections, is there a third party program that could be used to display a grid showing where each section was?I have more questions, but those all depend on what (if anything) is possible.Hopefully somebody can point me in the right direction. Thanks Edited February 24, 2012 by BitOfHope Link to comment Share on other sites More sharing options...
sleepydvdr Posted February 24, 2012 Share Posted February 24, 2012 I can only address #2 and #3. You do not need an outside program to draw gridlines. Below is an example of your screen getting split up in to 100 equal sections. Press the ESC key to exit. expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #NoTrayIcon $width = @DesktopWidth $height = @DesktopHeight Global $tRECT, $hFont, $hOldFont, $hDC HotKeySet("{ESC}", "_Exit") $tRECT = DllStructCreate($tagRect) DllStructSetData($tRECT, "Left", 5) DllStructSetData($tRECT, "Top", 5) DllStructSetData($tRECT, "Right", 250) DllStructSetData($tRECT, "Bottom", 50) $hDC = _WinAPI_GetDC(0) $hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') $hOldFont = _WinAPI_SelectObject($hDC, $hFont) _WinAPI_SetTextColor($hDC, 0x0000FF) _WinAPI_SetBkColor($hDC, 0x000000) While 1 For $i = 1 To 100 step 1 _WinAPI_DrawLine($hDC, $width / 100 * $i, 0, $width / 100 * $i, $height) Next Sleep(100) WEnd Func _Exit() _WinAPI_SelectObject($hDC, $hOldFont) _WinAPI_DeleteObject($hFont) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_InvalidateRect(0, 0) $tRECT = 0 Exit EndFunc ;==>_Exit #include <ByteMe.au3> Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2012 Moderators Share Posted February 24, 2012 BitOfHope,There is nothing native in AutoIt to let you "lock on" to a particular pixel. You would have to write a function to do it and the speed of the various Pixel* functions are such that I doubt you could follow that particular pixel if it were moving with any speed. But I am quite prepared to be proved wrong on that last point. What sort of "lock on and follow" behaviour were you contemplating? 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...
BitOfHope Posted February 24, 2012 Author Share Posted February 24, 2012 I can only address #2 and #3. You do not need an outside program to draw gridlines. Below is an example of your screen getting split up in to 100 equal sections. Press the ESC key to exit. expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #NoTrayIcon $width = @DesktopWidth $height = @DesktopHeight Global $tRECT, $hFont, $hOldFont, $hDC HotKeySet("{ESC}", "_Exit") $tRECT = DllStructCreate($tagRect) DllStructSetData($tRECT, "Left", 5) DllStructSetData($tRECT, "Top", 5) DllStructSetData($tRECT, "Right", 250) DllStructSetData($tRECT, "Bottom", 50) $hDC = _WinAPI_GetDC(0) $hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') $hOldFont = _WinAPI_SelectObject($hDC, $hFont) _WinAPI_SetTextColor($hDC, 0x0000FF) _WinAPI_SetBkColor($hDC, 0x000000) While 1 For $i = 1 To 100 step 1 _WinAPI_DrawLine($hDC, $width / 100 * $i, 0, $width / 100 * $i, $height) Next Sleep(100) WEnd Func _Exit() _WinAPI_SelectObject($hDC, $hOldFont) _WinAPI_DeleteObject($hFont) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_InvalidateRect(0, 0) $tRECT = 0 Exit EndFunc ;==>_Exit Thanks, it works great and after 10 minutes of googling I was able to start understanding some of the parts I didn't understand ;D Link to comment Share on other sites More sharing options...
BitOfHope Posted February 24, 2012 Author Share Posted February 24, 2012 (edited) BitOfHope,There is nothing native in AutoIt to let you "lock on" to a particular pixel. You would have to write a function to do it and the speed of the various Pixel* functions are such that I doubt you could follow that particular pixel if it were moving with any speed. But I am quite prepared to be proved wrong on that last point. What sort of "lock on and follow" behaviour were you contemplating? M23Well, long story short: At work I have times of 'sit there and wait' which last anywhere from 2 minutes to 2 hours. So I like to keep myself busy, but I can't hop onto xbox live or anything without getting interrupted(which I find highly annoying). Autoit is great for keeping me busy.As silly as it may sound, I'm doing little exercises with pictures/colors (sometimes I just use my desktop icons) to test what is possible. It's really simple: Put the color over at 'this part of my screen' and then click and drag it over to 'this part'. Then try and see if the script will find the same color again. So I was hoping there would be an actual way to 'lock on' to that color(pixel?). But I guess not, so I'll have to use other methods. That's what the grid is for. I was thinking "Hey, what if the screen was divided up into tons of little boxes? Then I could place my desktop icon in 'gridbox1' so then when the script detects that color(desktop icon) in 'gridbox1' it could make it's own action for that specific grid. Then if it finds that color in 'gridbox14' it could do something slightly different..." etc etc.Would that not work the way I'm imagining it? I figure it's as good as any other way to learn new things.Edit: Sorry for the doublepost. Edited February 24, 2012 by BitOfHope Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2012 Moderators Share Posted February 24, 2012 (edited) BitOfHope, Not silly at all - a good way of learning how to use AutoIt. You might find this of interest. I have not used it myself, but it seems to do quite a lot of what you want - locating an image on screen for example. M23 Edited February 24, 2012 by Melba23 Fixed link 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...
Dana Posted February 24, 2012 Share Posted February 24, 2012 You can't "lock on" to a moving pixel for the reason that the pixel itself isn't moving. Let's say you have a red pixel at 50,50 and it moves to 50,51. It doesn't really "move"; the pixel at 50,50 goes dark (or to another color) and the pixel at 50,51 that was previously dark is now illuminated to red. But it's a different pixel. 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