Jump to content
Sign in to follow this  
Graymatter

If not @ error or If..then

Recommended Posts

Graymatter

Example:

while 1

funct()

wend

funct()

pickab()

pickcd()

Endfunc

Func pickab()

$somevar = pixelsearch( parameters)

if not @error then

execute some action

endif

else

$someothervar = pixelsearch(parameters)

if not @error then

execute some action

endif

Endif

Endfunc

My question is:

if func pickab() re written as;

Func pickab()

if $somevar = pixelsearch( parameters) then

execute some action

elseif $someothervar = pixelsearch(parameters) then

execute some action

endif

else

some msg

Endfunc

Would this be correct ?

I just want to know which option would be better off for me.

:whistle: Thanks for your help in advance and if some one wants to crack up a wise ("u should have done this or that before posting this blah blah) the least you could do is be polite about it.


[quote]I am so clever that sometimes I don't understand a single word of what I am saying.[/quote]

Share this post


Link to post
Share on other sites
SmOke_N

My question is:

if func pickab() re written as;

Would this be correct ?

I just want to know which option would be better off for me.

No, you need to check the helpfile for what PixelSearch Returns (I sound like a broken record tonight with saying that)

Edit:

However, I've never done this, but I don't see why it wouldn't work:

If IsArray(PixelSearch(params....)) Then
    ;Do Something
EndIf
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Graymatter

No, you need to check the helpfile for what PixelSearch Returns (I sound like a broken record tonight with saying that)

Edit:

However, I've never done this, but I don't see why it wouldn't work:

If IsArray(PixelSearch(params....)) Then
    ;Do Something
EndIf
Lol i have seen most of your posts you seem to be working way to hard coz you are always tired ;) . Take some rest.

Anyways, so you are saying its good to check if pixel search has any array rather than checkin it with if NOT @ error, actually you got a point . But i know if not @ error works i just want you to focus on the if not @ error / if ... then function in this very particular case.

P.S: Whats the best way to test out both on terms of Speed and accuracy.

I will give a hint what i am trying to pull off. Will post the code when i can make some sense of it.

I want to search pixel for bottom > if nuthing then top and left > if nuthing then right.

Additionally i would try to add a timer (execution time of each function ) whichever executes faster i would be executing only that chunk of code.

For this i would be storing the times into an array, perform smallest of array search value on it and execute the block on that bases.

:whistle: if i can pull all this off that is.

So basically for that i just need to know which function would be faster also correct.

Edited by Graymatter

[quote]I am so clever that sometimes I don't understand a single word of what I am saying.[/quote]

Share this post


Link to post
Share on other sites
SmOke_N

Lol i have seen most of your posts you seem to be working way to hard coz you are always tired ;) . Take some rest.

Anyways, so you are saying its good to check if pixel search has any array rather than checkin it with if NOT @ error, actually you got a point . But i know if not @ error works i just want you to focus on the if not @ error / if ... then function in this very particular case.

P.S: Whats the best way to test out both on terms of Speed and accuracy.

I will give a hint what i am trying to pull off. Will post the code when i can make some sense of it.

I want to search pixel for bottom > if nuthing then top and left > if nuthing then right.

Additionally i would try to add a timer (execution time of each function ) whichever executes faster i would be executing only that chunk of code.

For this i would be storing the times into an array, perform smallest of array search value on it and execute the block on that bases.

:whistle: if i can pull all this off that is.

So basically for that i just need to know which function would be faster also correct.

OCR?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Graymatter

OCR?

I wonder how many times you typed "OCR?". No. I aint got that much graymatter.

Simple kinder garden pixelsearch. But i think i confused you. Let me rephrase:

Func picab()

if something<>something then

executeme

else

executeyour

Endif

or should it be

Func picab()

something=something

if not @error then

execute me

elseif something <> something then

executeyou

Endif


[quote]I am so clever that sometimes I don't understand a single word of what I am saying.[/quote]

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  

×