Jump to content

Bunch of questions-


Recommended Posts

Okay so I saved up a bunch of questions concerning different aspects of AutoIt:

-PixelSearch for a range of pixels. Something i asked before but thread got lost...If i had say 2 pixels is it possible to search every pixel in between the 2 hexes rather then having to find 1 in the middle and then use variations...

-How exactly does PixelSearch work? Does it scan top left corner to bottom left corner in rows until it finds the first pixel that fits the target pixel+variations or does it scan the entire area and then give coords of the best fit?

-Just a dumb question about my code...which doesn't seem to work.

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

this seems to not work...ever. I usually end up closing the script through task manager.

-Would it be possible to make a function based on PixelSearch to give coordinates of ALL pixels that fit the hex+variations rather then just first one. Put in context, hypothetically say there is a help program that would draw red rectangles around buttons whatnot. Using pixelsearch to ID the boxes would be extremely problematical since the rectangle would always shift-up/down left right ie:never stay simetric with the actual button. now if you had say 3 pixels then its much easier to fit a rectangle around that...

-sliders: i am having extremely hard time reading data off slider. I can create one in my GUI (if i am lucky and it actually appears) but when i try to set a variable to get the info of the slider the script magically gets f*cked...will post code later don't have it on this computer..

Any and all help appreciated.

Edited by Blahbots
Link to comment
Share on other sites

Blahbots,

Sorry cannot answer your Other questions but...

Only thing I can see wrong here is the lack of a closing WEND to your WHILE statement.

Or you could do ::

WHILE 1
     $msg = GUIGetMsg()
     SWITCH $msg
     CASE $GUI_EVENT_CLOSE
     EXIT
     CASE ELSE
     CONTINUELOOP
     ENDSWITCH
WEND

nah just didnt post the entire thing:

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

Exit

Case $msg = somecodehere

stuff happens here

Case $msg = morecodehere

alotof other stuff happeninoing here

ase $msg = the finalcodebit

weee even more stufff....

EndSelect

Wend

Thanks for response though...seems like it will be the only one:(

Edited by Blahbots
Link to comment
Share on other sites

sorry for a bump but for a thing i am writing i really need 2 of the questions answered: the

Would it be possible to make a function based on PixelSearch to give coordinates of ALL pixels that fit the hex+variations rather then just first one. Put in context, hypothetically say there is a help program that would draw red rectangles around buttons whatnot. Using pixelsearch to ID the boxes would be extremely problematical since the rectangle would always shift-up/down left right ie:never stay simetric with the actual button. now if you had say 3 pixels then its much easier to fit a rectangle around that...

and -PixelSearch for a range of pixels. Something i asked before but thread got lost...If i had say 2 pixels is it possible to search every pixel in between the 2 hexes rather then having to find 1 in the middle and then use variations..

Link to comment
Share on other sites

Taken from the HELPFILE

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.

Remarks

The search is performed left-to-right, top-to-bottom and the first match is returned.

Earlier versions of AutoIt (prior to v3.0.102) used the BGR format for defining color - newer versions use RGB by default but this can be changed using the ColorMode option.

Remember, a typical display at 1024 x 768 has 786432 pixels. Although PixelSearch is optimized, narrowing the search area helps speed up the result.

Link to comment
Share on other sites

Okay so I saved up a bunch of questions concerning different aspects of AutoIt:

-PixelSearch for a range of pixels. Something i asked before but thread got lost...If i had say 2 pixels is it possible to search every pixel in between the 2 hexes rather then having to find 1 in the middle and then use variations...

This question betrays a misunderstanding of how RGB colors work. The numbers "between" two RGB values do not represent near matches. The 24bit number must be broken into three 8bit color values (Red, Green, and Blue), and each compared individually. In addition, you must decide on how you will mathematically describe total variance based on the individual color differences.

-How exactly does PixelSearch work? Does it scan top left corner to bottom left corner in rows until it finds the first pixel that fits the target pixel+variations or does it scan the entire area and then give coords of the best fit?

Exactly as described in the help file. The first match within the given variation will be returned.

-Just a dumb question about my code...which doesn't seem to work.

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

this seems to not work...ever. I usually end up closing the script through task manager.

I've never seen that code NOT work... ever (given the missing WEnd). Post a short symptom reproducer script that will show us that code not working. If you can, you will have uncovered a serious bug, but it is much more likely you've made a serious mistake not shown here, like trying to use GuiGetMsg() after setting GuiOnEventMode.

-Would it be possible to make a function based on PixelSearch to give coordinates of ALL pixels that fit the hex+variations rather then just first one. Put in context, hypothetically say there is a help program that would draw red rectangles around buttons whatnot. Using pixelsearch to ID the boxes would be extremely problematical since the rectangle would always shift-up/down left right ie:never stay simetric with the actual button. now if you had say 3 pixels then its much easier to fit a rectangle around that...

You could certainly code such a loop, but it would be extremely slow in use, unless the area searched was kept very limited. If you were interested in such boxes around buttons it would be more reasonable to list all the button controls in the GUI, get their coordinates, and check their perimeters for red pixels.

-sliders: i am having extremely hard time reading data off slider. I can create one in my GUI (if i am lucky and it actually appears) but when i try to set a variable to get the info of the slider the script magically gets f*cked...will post code later don't have it on this computer..

Again, no code to demonstrate the problem means it only exists in your head... :P

Any and all help appreciated.

Posting short reproducer scripts to demonstrate you problems will get you more answers, but more time with the help file and the effort required to make a reproducer script often leads to discovery of the answer anyway!

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...