Jump to content

OnlyForMe

Members
  • Posts

    5
  • Joined

  • Last visited

OnlyForMe's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi, I managed to get everything working with VB and AutoIt, and now I wish to work on performance. In VB, I do this: Do PixelSearch(500,450,500,450,&HFFFFFF,0,1) Loop Until AutoIt.Error = False MessageBox.Show("The pixel has been found.") Ok, it all works fine, however the speed is a bit floppy. I'm guessing it's because of the loop. It's an infinite loop that is spiking my CPU, etc. I did put Thread.Sleep in the loop, and it helps a little, but not very much at all. Is there a way to optimize this loop for speed? What I"m doing is scanning my desktop for one pixel and then reacting with another function once the pixel is found. (When I press my button, the pixel is not there, so it's an infinite scanning loop until the pixel appears, then my program reacts). The program runs for no more than 1 second by the way. The pixel I'm looking for always appears within one second. Thanks!
  2. I have a question. How can I just search for ONE pixel, instead of the pixel closest to the given point? I have mine set to search for one pixel, but it always returns true even if the pixel doesn't exist. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FastFind.au3> $Main = GUICreate("", 100, 50, -1, -1) $Button1 = GUICtrlCreateButton("Button1", 0, 24, 73, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 WinActivate("Calculator") Sleep(1000);Give some time to react. $FFhWnd = WinGetHandle("Calculator") FFSetWnd($FFhWnd) Do FFNearestPixel(108, 142, 0x000000, True) Until @Error = False MsgBox(0,"Ok", "Pixel Found!") EndSwitch WEnd Even if the pixel doesn't exist, the MsgBox still appears. I think it's because it's searching the whole program, instead of just the area I specified. Any ideas on what to do?
  3. By accuracy I mean that I want it to take the same amount of time each time to find the pixel. Let's say I use PixelSearch 5 times: Original PixelSearch Results: 25ms 37ms 28ms 17ms 40ms What I'm trying to achieve results: 25ms 27ms 26ms 24ms 25ms I just used 25 as a default, It can be any number, but it needs to be +/- 5ms of that number. Possible?
  4. I just want accuracy. I don't care about speed. Thanks, but I tried using a PixelGetColor loop and it's actually worst than the normal pixelsearch. Thanks for the advice on the performance decreasing if I have it running long, though. Also, I have a Quad Core Processor with 6gb RAM and dedicated ATI 512mb Graphics.
  5. Hello everyone. I've been using the pixelsearch function like this: Do PixelSearch(StartX,StartY,EndX,EndY,Color) Until @error = False It's only searching for one pixel at a time and I have aero disabled. I'm not having any problems, it's just that sometimes it takes longer for AutoIt to react to success than other times. For instance, if I time how long it takes for PixelSearch to complete it sometimes varies from 25ms - 50ms. Is there a better way to make a pixelsearch loop or a better function to achieve accuracy? I'm looking for accuracy from about 25ms - 30ms (+/- 5ms. I don't really care how long it takes. It could take 500ms, and I wouldn't care, but I need it to be accurate. I don't care about speed.) Thanks!
×
×
  • Create New...