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

    • TheAutomator
      By TheAutomator
      Hi!

      I'm trying to script an ellipse drawing algorithm in AutoIT for learning purposes.
      I use an edit control to "draw" the ellipse with characters.
      The code i have works kinda good but i would like to see if others around here know a better algorithm to do it..
      I would like to be able to give the x, y and width, height arguments to the function and not have to start at the middle point and draw the ellipse around it.

      side note, the ellipse glitches when it has to be 2 pixels high too..
       
      func ellipsePlotPoints ($xc,$yc, $x,$y) pixel ($xc + $x, $yc + $y) pixel ($xc - $x, $yc + $y) pixel ($xc + $x, $yc - $y) pixel ($xc - $x, $yc - $y) endfunc func ellipse($xc,$yc, $a,$b) local $a2 = $a * $a local $b2 = $b * $b local $twoa2 = 2 * $a2 local $twob2 = 2 * $b2 local $p local $x = 0 local $y = $b local $px = 0 local $py = $twoa2 * $y ; Plot the initial point in each quadrant. ellipsePlotPoints ($xc,$yc, $x,$y) ; Region 1 $p = int($b2 - ($a2 * $b) + (0.25 * $a2)) while ($px < $py) $x+=1 $px += $twob2 if ($p < 0) then $p += $b2 + $px else $y-=1 $py -= $twoa2 $p += $b2 + $px - $py endif ellipsePlotPoints ($xc,$yc, $x,$y) wend ; Region 2 $p = int ($b2 * ($x+0.5) * ($x+0.5) + $a2 * ($y-1) * ($y-1) - $a2 * $b2) while ($y > 0) $y-=1 $py -= $twoa2 if ($p > 0) then $p += $a2 - $py else $x+=1 $px += $twob2 $p += $a2 - $py + $px endif ellipsePlotPoints ($xc,$yc, $x,$y) wend endfunc  
    • nikink
      By nikink
      Hi all,
      I have a bit of code that works on my old Win10 PC, that fails on my new Win10 PC, and I think the only significant difference is the version of Autoit - old PC has 3.3.12, new has 3.3.14.
      I couldn't find anything mentioned in the change logs though, so perhaps I'm wrong.
      Anyway, the code to replicate my issue is:
      Test('username', 'DOMAIN') ; THIS ERRORS: ;Test('localun', 'DOMAIN') ; THIS ERRORS: ;Test(' ', ' ') ; THIS ERRORS: ;Test('', '') ; THIS ERRORS: ;Test('localun', '') ; THIS ERRORS: ;Test('', 'DOMAIN') Func Test($un, $dom) $compName = 'PCNAME' $FullName = '.' $Description = '.' ; get the WIM object $objWMIService = ObjGet("winmgmts:\\" & $compName & "\root\cimv2") ; get default user full name and description $objAccount = $objWMIService.Get("Win32_UserAccount.Name='" & $un & "',Domain='" & $dom & "'") If IsObj($objAccount) Then $FullName = $objAccount.FullName $Description = $objAccount.Description EndIf ConsoleWrite($FullName & @CRLF) ConsoleWrite($Description & @CRLF) Return EndFunc  
      On my old PC this code will output just . and . for each of those line currently commented out. Which is fine.
      On my new PC any of those commented out lines of code cause an error, and the script won't even compile.
      $objAccount = $objWMIService.Get("Win32_UserAccount.Name='" & $un & "',Domain='" & $dom & "'") $objAccount = $objWMIService^ ERROR I'm very much a newb with the WMI stuff and objects, but it looks like the .Get property is failing when either $un or $dom aren't valid in v3.3.14, whereas in 3.3.12 the .Get would fail to return an object, which is then caught by the If statement.
      Am I on track with this? Is there some new/better way to code the example so that 3.3.14 will compile it?
    • Eggsplorer
      By Eggsplorer
      Hi,
      Ich hab ein Script für Windows Updates, dass nach dem OOBE aufgerufen werden soll. Run/RunOnce ist daher nicht möglich.
      Stattdessen möchte ich das Script in den Autostart schreiben lasse. Wenn die OOBE beendet wird und der Administrator angemeldet wird, soll das Update-Script einmalig aufgerufen werden und sich anschl. selbst löschen.
      Lang rede, kurzer Sinn:
      Wie kann ich folgendes Script in den Autostart schreiben?
      RunWait(@ComSpec & " /c " & "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\UA\Scripts\win-updates.ps1 -MaxUpdatesPerCycle 100 -RestartRequired 1", "") Ich würde ungern eine BAT oder EXE reinkopieren, da ich es unsauber finde. Die müsste ja auch zusätzlich irgendwo liegen.
      Danke
      Eggsplorer
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone
      I worked a bit on a little project of mine, and I managed to do what I was trying to do, or, automate a quiz in AutoIt.
      Now, everything works fine but, in order to achieve what I'm trying to achive, I'd like to make this script run faster.
      I'll attach a portion of the code in order to let you understand what my script does.
      $objIE_h1 = _IETagNameGetCollection($objIE, "h1") ; Take the text of the answer If @error Then ConsoleWrite("Errore durante la lettura degli h1 nella pagina. - Errore: " & @error & @CRLF) Else For $objElement In $objIE_h1 $strInnerText = $objElement.innerText Next Select Case StringInStr($strInnerText, "QUESTION") ; Here is the question ; PS4 PRO $objSpans = _IETagNameGetCollection($objIE, "span") ; Answers are stored here For $objElement In $objSpans If $i >= 4 Then $strAnswer = $objElement.innerText ; Take the text of the answer n° 0, 1, 2, 3 If StringInStr($strAnswer, "CORRECT ANSWER") Then ; If I match the correct answer, then, I have to click on the input with answer id = answer_i $j = $i - 4 $objInput = _IEGetObjById($objIE, "answer_" & $j) If @error Then ConsoleWrite("Errore durante la lettura della risposta #" & $i & " - Errore: " & @error & @CRLF) Else _IEAction($objInput, "click") If @error Then ConsoleWrite("Errore durante il click sull'elemento. - Errore: " & @error) Else ConsoleWrite($j & ") Risposta: " & $strAnswer & @CRLF) ExitLoop EndIf EndIf EndIf $i+=1 Else $i+=1 EndIf Next $i = 0 $j = 0 This is what my script does.
      Questions are 20, in which I have 15 multiple choice question, 2 images ( on which I use _IEImgClick() ), and 3 text inputs ( a simple send with the text I have to enter ).
      How can I make all of these, faster?
      If I reach this goal, I've probably done one of my best goals in life, and I'd like to share my happiness with you, giving a huge donation to this fantastic community!
      Thanks for your help
    • au3leecher
      By au3leecher
      Hellow everybody,
      I tryed to manipulate a game called "Assault Cube" which is a easy beginning in coding. I run the code but the wished value doesn't change, i don't understand why.
      The Pointers are fine, I checked that the pointers don't change every time while restart the game.
      My Code:
      <snip>
      _____________________________________________________________________________________________________________________________________________________________________________________________
      Checklist:
      The Offsets are 18C & 4
      In Cheat Engine: ("ac_client.exe"+0010F418) <- Pointer
      4 Bytes = 'dword'