Jump to content

do loop for pixelgetcolor wait until then


 Share

Recommended Posts

I have gotten so much help on my ini storage program and finally got it completed thank you to Robjong and Zedna for that also to Valik for being so kind lol.

I am at ohio state and do alot of work using team viewer through my cell phone. if i setup my desktop to a certain resolution it shows up perfect on my droid razr. So what im looking for is a pixelgetcolor to look in the 160, 230 for a color 0x000038 which is the color that pops up from my window when team viewer gets activated. How can i set this up to keep looking in this one spot until that pops up? here is what i have.

Func Start()
Do
PixelGetColor( 160, 230)
If
0x000038 Then

EndFunc

I know its super weak and small but in AHK I had it search for that pixel then assign color codes to a setup, these color codes got loaded right away. They would determine if I was on my droid bionic or Razr. I have both for my business line that I sometimes would use. I used the L or R to determine the correct phone.

LX1 := 387, LY1 := 204, LScolour := 0xD0F3FD
RX1 := 432, RY1 := 204, RScolour := 0x9CEAFC
LX2 := 366, LY2 := 112, SLcolour := 0xDFFFFF
RX2 := 451, RY2 := 113, SRcolour := 0xEEFFFF 
LX3 := 366, LY3 := 141, BLcolour := 0xE8FFFF 
RX3 := 450, RY3 := 140, BRcolour := 0xE8FFFF

I had this looping the enitre time

Loop                            
{
    PixelGetColor, teamviewer, 160, 230
    If (teamviewer = 0x000038)
    {
X1 := LX1, Y1 := LY1, secondcolour := LScolour, X2 := LX2, Y2 := LY2, topstagecolour := SLcolour, X3 := LX3, Y3 := LY3, bottomstagecolour := BLcolour,
     Break
    }
    If EndScript
    Break
    Sleep, -1
}

PixelGetColor, TeamRight, 777, 230 
If (TeamRight = 0x000000)
X1 := RX1, Y1 := RY1, secondcolour := RScolour, X2 := RX2, Y2 := RY2, topstagecolour := SRcolour, X3 := RX3, Y3 := RY3, bottomstagecolour := BRcolour

once the pop up was found another loop was taken place almost identical to the one above except it looks in the corner to see if my razr or bionic was the requester like above it would set where to look and what color to look for depending on which phone it came from. the remainder of loops that would get set after this would use the names like

pixelgetcolor, secondcolour, x1, y1 ; which would read the coordinates accordingly.

what im getting confused on is this is what ahk uses

PixelGetColor, OutputVar, X, Y [, Alt|Slow|RGB]

autoit doesnt have an outputvar. I am also not sure where to insert the coordinates needed depending on which color shows up. I am still writing this whole thing and am looking forward to publishing this once im done.

Link to comment
Share on other sites

figured i could do some

#region - Global
Global $LX1 = 387
Global $LY1 = 204
Global $LSColour = 0xD0F3FD
Global $RX1 = 432
Global $RY1 = 432
Global $RSColour = 0x9CEAFC
Global $LX2 = 366
Global $LY2 = 112
Global $SLColour = 0xDFFFFF
Global $RX2 = 451
Global $RY2 = 113
Global $SRColour = 0xEEFFFF
Global $LX3 = 366
Global $LY3 = 141
Global $BLColour = 0xE8FFFF
Global $RX3 = 450
Global $RY3 = 140
Global $BRColour = 0xE8FFFF
Global $LX4 = 387
Global $LY4 = 180
Global $LBColour = 0xB4F6FD
Global $RX4 = 430
Global $RY4 = 180
Global $RBColour = 0xB4F6FD
#endregion - Global

would these globals work like i have these set in AHK

LX4 := 387, LY4 := 180, LBcolour := 0xB4F6FD   
RX4 := 430, RY4 := 180, RBcolour := 0xB4F6FD 

LX2 := 366, LY2 := 112, SLcolour := 0xDFFFFF   
RX2 := 451, RY2 := 113, SRcolour := 0xEEFFFF     

LX3 := 366, LY3 := 141, BLcolour := 0xE8FFFF   
RX3 := 450, RY3 := 140, BRcolour := 0xE8FFFF 

LX1 := 387, LY1 := 204, LScolour := 0xD0F3FD     
RX1 := 432, RY1 := 204, RScolour := 0x9CEAFC
Link to comment
Share on other sites

[url="../../../autoit3/docs/keywords.htm"]While[/url] 1
        [url="../../../autoit3/docs/keywords.htm"]If[/url] [url="../../../autoit3/docs/functions/PixelGetColor.htm"]PixelGetColor[/url](160, 230) = $0x000038 [url="../../../autoit3/docs/keywords.htm"]Then[/url]
        X1 = LX1, Y1 = LY1, secondcolour = LScolour, X2 = LX2, Y2 = LY2, topstagecolour = SLcolour, X3 = LX3, Y3 = LY3, bottomstagecolour = BLcolour, X4 = LX4, Y4 = LY4, bottomcolour = LBcolour
         [url="../../../autoit3/docs/keywords.htm"]ExitLoop[/url]
        [url="../../../autoit3/docs/keywords.htm"]EndIf[/url]
        [url="../../../autoit3/docs/functions/Sleep.htm"]Sleep[/url](10)
    [url="../../../autoit3/docs/keywords.htm"]WEnd[/url]

While 1
        If PixelGetColor(x1, y1) = $LSColour Then
            ExitLoop
        EndIf

will this work? im trying to mess with it while typing lol i know i reply to myself alot i just want the helpers to know that i am really going at this and only need a little edge :)

Link to comment
Share on other sites

Is there a reason why you are using pixel colour rather than checking for the windows popping up? Just thinking that using that might be easier:

$_Window_Title = "TeamViewer"
$_Rez_1="1024x768"
$_Rez_2="800x600"
While 1
If WinExists($_Window_Title,"razr") Then
  Set_Screen_Res($_Rez_1)
ElseIf WinExists($_Window_Title,"bionic") Then
  Set_Screen_Res($_Rez_2)
EndIf
WEnd
Obviously that is only Pseudo-code and a little bit of what would be needed, but hopefully a start for you.
Link to comment
Share on other sites

Thats whats up Techn0mancer, I was pixelgetcoloring due to the fact i didnt know you could do that lol. im going to look into it alot more thank you,

but im still going to keep my options open on the pixel search as it has worked rather nicely for me so far any idea on how to do that.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...