Jump to content

Question About Pixel Command


Recommended Posts

Ok basically how would i make a part of my program do this:

Search in a rectangular box and IF a certain pixel color that i specificy is NOT found in

that box, the program will go on to the next part of the script. For example also, what kind of loop should i

use? i dont think a "For" loop would work for this.

Link to comment
Share on other sites

a do...while loop.

Waitup as i fish out an example!

#)

EDIT:

do
   Sleep(200)
   PixelSearch ( left, top, right, bottom, color)
while @error = 1
Edited by nfwu
Link to comment
Share on other sites

Wont i need a Wend statement?

Here is my CURRENT code for my program!

(Explanation Follows under it)

#include <IE.au3>

sleep ("2000")

$oIE = _IECreate ( )

_IENavigate ( $oIE,"xxxxxINBOX@xxxx.com" )


For $x = 1 to 66 Step 1

$PScoord = PixelSearch(482,624,637,653,16777215) 

Mousemove($PScoord[0], $PScoord[1]) 

MouseClick ( "left") 

sleep("3000") 

$PScoord1 = PixelSearch(44,236,600,600,255) 

MouseMove ($PScoord1[0], $PScoord1[1]) 

MouseClick ("left")

sleep("42000") 

Send("{ALTDOWN}{F4}{ALTUP}")

sleep("1000") 

Send("{ALTDOWN}{F4}{ALTUP}") 

WinActivate("xxxxxINBOX@xxxx.com", "")  [This is done in case of popups]

_IELoadWait($oIE) 

$PScoord2 = PixelSearch(648,627,728,652,16777215) 

MouseMove ($PScoord2[0], $PScoord2[1]) 

MouseClick ("left") 

sleep("1000")  

MouseMove(688,600)  

MouseClick ("left") 

_IELoadWait($oIE) 

sleep ("1000") 

do

   Sleep(200)

   PixelSearch ( 482, 624, 637, 653, 16777215)
while @error = 1

next

Basically what i WANT this program to do is to go to my onsite mail box on the SITE: xxxxINBOX@xxxx.com

I then have it Open up the first email, Open the link contained within the email, leave the new page open

for 42 seconds, close the page,

close the email, delete the email, open next email etc etc. So far i have done this and it *kinda* works

BUT I obviously dont have Infinate emails and the way i look to find the link is :

$PScoord = PixelSearch(482,624,637,653,16777215) 

Mousemove($PScoord[0], $PScoord[1]) 

MouseClick ( "left")

So once i run out of emails, i want my program to kinda think to itself :

[Computer thought]

Okay Pixel search Couldnt find the

color "16777215" (Link color) in the area where its supposed to be found (482,624,637,653 )So therefore i

have run out of emails to click, and now i will navigate to site YYYYYYYINBOX@YYYYY.COM and then i will

follow the rest of the script that my master created to open/view the emails (LOL)

[/Computer Thought]

I have a feeling my WHOLE code architecture is wrong (Such as my crappily made for loop.)

PLEASE bare with me, i am a completel autoit Newb and i have been working all day on this and its

extremely frustrating. IF ANYTHING doesnt make sense to you, please ask and i will try to re-iterate my

thought process.

I am EXTREMELY greatfull for any suggestions/advice/help that is offered for me, Thanks a bunch!

Edited by phatzilla
Link to comment
Share on other sites

Failure: Sets @error to 1 if color is not found.

$PScoord = PixelSearch(482,624,637,653,16777215) 

Mousemove($PScoord[0], $PScoord[1]) 

MouseClick ( "left")

...Turns into this:

$PScoord = PixelSearch(482,624,637,653,16777215) 
If @error = 1 Then Exit;;quit application

Mousemove($PScoord[0], $PScoord[1]) 

MouseClick ( "left")

#)

Link to comment
Share on other sites

So "If @error = 1 Then Exit"

that basically means if an error message pops up, it exits the script?

Im kinda confused.... how would i make it so that if the links color isnt

found in the pixelsearchbox, it opens up the site www.google.com for

example.. (I really dont want it to do just that, i want it to go on to another big part of the program

which entails it opening up another site, going to inbox, and repeating what i did for the first site)

Edited by phatzilla
Link to comment
Share on other sites

So "If @error = 1 Then Exit"

Read the help file, for goodness sake!!!

PixelSearch

--------------------------------------------------------------------------------

Searches a rectangle of pixels for the pixel color provided.

PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )

Parameters

left left coordinate of rectangle.

top top coordinate of rectangle.

right right coordinate of rectangle.

bottom bottom coordinate of rectangle.

colour Colour value of pixel to find (in decimal or hex).

shade-variation [optional] A number between 0 and 255 to indicate the allowed number of shades of variation of the red, green, and blue components of the colour. Default is 0 (exact match).

step [optional] Instead of searching each pixel use a value larger than 1 to skip pixels (for speed). E.g. A value of 2 will only check every other pixel. Default is 1.

Return Value

Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y)

Failure: Sets @error to 1 if color is not found.

It's that text in big and bold and italic and red and centered...

:)

#)

Edited by nfwu
Link to comment
Share on other sites

SetError

--------------------------------------------------------------------------------

Manually set the value of the @error macro.

SetError ( code [, extended [, return value]] )

Parameters

code The required value (integer) to set the @error macro to.

extended The optional value (integer) to set the @extended macro to. This sets the same macro as the SetExtended() function.

return value Override the default return value and return this parameter.

So:

SetError(0)

#)

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...