Jump to content



Photo

Do PixelSearch Until, Then


  • Please log in to reply
2 replies to this topic

#1 mrwizardd

mrwizardd

    Seeker

  • Normal Members
  • 2 posts

Posted 19 August 2012 - 02:20 AM

Hey folks, my brains fried. i've been stuck at this line of code for a couple hours now. I've done Google searches, forum searches, etc.. I'm making no progress and I feel like I've tried every variation of the code possible. It's a simple program to open a 3d application I'm working on so I can Log in.


$default_resolutionX = 1920
$default_resolutionY = 1080
$x_ratio = @Desktopwidth / $default_resolutionX
$y_ratio = @Desktopheight / $default_resolutionY

Run ("C:\Program Files (x86)\3dMax\Projects\Project1.exe")

Do
$Pixel2 = PixelSearch(0,0,(1113 * $x_ratio),(616 * $y_ratio),0xF6F8FC,3)
Until @error Then
If not @error Then
MouseClick("left", Round(1113 * $x_ratio),Round(616 * $y_ratio))
Endif
Do
$Pixel3 = PixelSearch(0,0,(1113 * $x_ratio),(616 * $y_ratio),0xF6F8FC,3)
Until @error Then
Do
$Pixel4 = PixelSearch(0,0,(959 * $x_ratio),(356 * $y_ratio),0xEF571D,3)
Until @error Then

Etc..

I realize this is grossly incorrect, but I re-did the coding that would make sense to me. Hopefully you can see my way of thinking and help explain how I'm getting everything wrong here. Having a hard time figuring out how to continue off of "Until @error" because it seems to just stop when it becomes true, instead of wanting to use the "Then" request. It basically needs to search for the launch button with the distinct red color at those coords, when it appears, clicks it, then starts searching for the next pixel, clicks a certain point on the screen, etc...

Thanks folks. Once I grasp this, should be smooth sailing. This is my first Autoit program, coming from DOS batch files.







#2 YogiBear

YogiBear

    deFinitely not yoUr average bear!

  • MVPs
  • 9,948 posts

Posted 19 August 2012 - 02:23 AM

Is there some reason why you simply can't access the control you want?

#3 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 19 August 2012 - 10:47 PM

Delete the "Then" after "Until @error" for start.
"Then" is a command following "If" command.
"Until" is the command following "Do"
I feel nothing.It feels great.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users