Sign in to follow this  
Followers 0
Tuurngait

Noobie Struggling with Pixels

14 posts in this topic

Okay so basically I have another problem with my script again, Not exactly the script it's self but more finding how to add a certain pixel color into it. I've made a few attempts and got it close but not close enough. I'm trying to make the mouse hover over the Pause Button on my Media Player. I'll add the Pixel color into the attachments. If someone could show me how to find the Pixel color in the form of the line "PixelSearch( 0, 0, $i, 768, 0xFF0000, 10 )" then I'd be the most greatful noobie that ever existed

misc4.au3

post-73895-0-34342300-1340485464_thumb.j

Share this post


Link to post
Share on other sites



Tools -> AutoIT info window.

Click and drag the target to where the pause button is and let go. In the info window, click on the mouse tab and it will have the color of where you let go of the target.

Share this post


Link to post
Share on other sites

I gave that a Shot. Now it's attracted to one of my desktop Icons but not the pause button. I tried multiple times but it just doesn't seem to wan't to move to the button.

Share this post


Link to post
Share on other sites

PixelSearch() returns after it finds the first instance of a colour in the search area.

There are a number of ways to try, I'll list two of them.

1. Change the direction of your search (see help file)

2. Find the position of the GUI (WinGetPos) and search only that area.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Is there a way I could get it to search the entire screen for the Pixel instead of just having it in one place with the (Wingetpos)? Because I often move my windows around so it won't always be in "fullscreen mode"

Share this post


Link to post
Share on other sites

yes but I realise I may not have expanded as much as I should of. Basically I know the script works. Because It follows a form of red on my desktop. But it doesn't have the same connection for when I run the Player, (even in full screen) it's almost as if it's a different red from the one on my desktop. The exact red of my pause button is displayed in the attachment part of the post. But for some reason when I do the Window AutoIT tool thing it gives me "0x14CF0000" as the color but that doesn't seem to be correct as it isn't attracted to that shade. The whole line I have is " $coord = PixelSearch( 0, 0, $i, 650, 0x14CF0000, 10 )"

Share this post


Link to post
Share on other sites

I see, I'm just guessing here, but it sounds like media player might employ the same method

which some full screen games do, which hinder the detection of pixels.

I don't know anything about that sorry. And I could be wrong.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

mokay, well is there away to maybe convert it to RGB? that'd be a simpler form I guess. Alot easier to get exact colors or even test colors. or maybe just have an imbetween so like imbetween red and purple?

Share this post


Link to post
Share on other sites

The problem here is that you are not understanding how the pixel search works. If you r searching for a red pixel and there is an icon on your desktop, it will return only the only one time which is the first instance that is true. You have the exact color. Using rgb will not change anything. It will still return the same thing.

I also don't understand why your pause and play button is red but that's another subject. If you really want to pause and play, look into controlclick because that will not require the window to be showing.

Share this post


Link to post
Share on other sites

well i don't know how to describe the button it'self but it's like a cirlce with a rectangle inside. and it's red. so thats that. but anyway. If the pixel search wont work is there another possible way i could do a search?

Share this post


Link to post
Share on other sites

Imagesearch is the next possible option or like I said before, controlclick.

Share this post


Link to post
Share on other sites
:D okay this is way too out of my league. i'll try something easier

Share this post


Link to post
Share on other sites

but i saw u used this: ( 0, 0, $i, 650, 0x14CF0000, 10 ) as your color but isnt the 10 at the end shade?

if so try 1 or 0 because at 10 it will detect yellow if its on ur screen or green instead of red 1 is ok if ur not sure what red it is 0 it only gets to the specified color.

as for the fullscreen problem maybe its solved this way.

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

  • Similar Content

    • argumentum
      By argumentum
      UDF to intercept the error window of AutoIt, showing more details about the error, including ability to save and send by email!
    • nacerbaaziz
      By nacerbaaziz
      Hello
      How are you
      I have a question, please.
      I've created a window and i need
      when i run the script if it detect an other copy from the same script was runing
       the script close the first copy Automatically and run a new copy
      I want an example to understand it
    • Nareshm
      By Nareshm
      Please Somebody Help me i am trying to create new script but, i don't know how to create it.

      I am Creating script like this :
      ; My script here [First Script]
      Check the internet connection, if internet connected then
      ; My Script here [Second Script]
      If internet not connected, wait for connect, after connected run my second script
      If Control id/windows/title matched do nothing and end/exit autoit script
      If Control id/windows/title not matched repeat my first and second script again until control id/windows/tittle not matched

      match with :
      >>>> Window <<<<
      Title:    PS :: Version - 2.8.0.0  - [PS Bill]
      Class:    WindowsForm734a
      Position:    -8, -8
      Size:    1382, 744
      Style:    0x17CD0000
      ExStyle:    0x00050100
      Handle:    0x0000000000130572
      >>>> Control <<<<
      Class:    WindowsForm734a
      Instance:    15
      ClassnameNN:    WindowsForm34a15
      Name:    BillPrint
      Advanced (Class):    [NAME:BillPrint]
      ID:    7875
      Text:    
      Position:    39, 310
      Size:    1221, 306
      ControlClick Coords:    745, 20
      Style:    0x56010000
      ExStyle:    0x00000000
      Handle:    0x00000000000C0468
       
    • SkysLastChance
      By SkysLastChance
      I get this error, Whenever I try to find a date. Does anyone have any idea why? I saw some post from 2015, However I would imagine this is fixed by now. @water
      >"J:\Temporary Files\XXXXXXXXX\AutoIt\AutoIt\AutoIt\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Users\XXXXXX\Desktop\Call Report Automation.au3"     "J:\Temporary Files\XXXXXXXX\AutoIt\AutoIt\AutoIt\Include\Excel.au3" (656) : ==> The requested action with this object has failed.: $aResult[$iIndex][1] = $oMatch.Name.Name $aResult[$iIndex][1] = $oMatch^ ERROR >Exit code: 1    Time: 5.791 #include <Excel.au3> Global $sExcelFile1 = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsm)") Global $sExcelFile2 = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "Excel Sheet (*.xlsx;*.xls)|All (*.*)") If FileExists($sExcelFile2) Then Global $oExcel2 = _Excel_Open () $oExcel2 = _Excel_BookOpen($oExcel2,$sExcelFile2) EndIF If FileExists($sExcelFile1) Then Global $oExcel1 = _Excel_Open () $oExcel1 = _Excel_BookOpen($oExcel1,$sExcelFile1,Default,Default,"2007") EndIF $oRead = _Excel_RangeRead ($oExcel2,Default,"A2",3) _Excel_RangeWrite ($oExcel1,"Calls Handled",$oRead,"BY7") Sleep (1000) _Excel_RangeFind ($oExcel1,$oRead,"E4:FD92") MsgBox (0,"Test",$oRead) UPDATE:
      If I take out this line it works. By works I mean I don't get the error. :/  However, I need it. I am just confused.
      _Excel_RangeWrite ($oExcel1,"Calls Handled",$oRead,"BY7")  
      UPDATE 2: I also get this error when trying to use the helpfile examples. I have version 3.3.14.2
      \AutoIt\AutoIt\AutoIt\Include\Excel.au3" (670) : ==> The requested action with this object has failed.: $oSheet = $oWorkbook.Sheets($iIndexSheets) $oSheet = $oWorkbook^ ERROR >Exit code: 1 Time: 0.8931  
    • TheDcoder
      By TheDcoder
      Hello
      I am relatively new to the world of Microsoft Office and the Excel UDF.
      I am trying to loop through every row in a spreadsheet and get the text/values from each column in the given row... so far I have looked into the Help file for the Excel UDF and the wiki page for Excel UDF but I have no idea about how this is done ... This is all I have in my script:
      Global $oExcel = _Excel_Open(False, False, False, False, True) Global Const $sSpreadsheet = @ScriptDir & '\data.xlsx' Global $oSpreadsheet = _Excel_BookOpen($oExcel, $sSpreadsheet, True, False) ; ... I am placing my bet on the _Excel_Range functions... especially _Excel_RangeRead. I don't know how $vRange works so I would be glad if someone can point me in the right direction . What I would ideally like is to get all of the contents of the spreadsheet (it's just a normal text one) in a 2D array.
      Thanks in Advance!