Re: automation

Posted by Godfather on August 10, 2008

In Reply to Re: automation posted by Fred Green p15901 on August 06, 2008

: : I am trying to make an application that loads a swf file in it. I think I got it down right; I made a TShockwaveFlash box and placed the htp into "Movie" field. Anyways, that's not really the problem I'm having. I don't know how to make it so that Delphi checks an x,y location on the screen and if the x,y area has gotten 10% brighter it simulates a button click. I think I may have gotten my button click thing right but I'm not sure about the whole 10% brighter thing and if I need to actually type out the x,y location in the getpixel thing.
: : begin
: : _getRGB[x,y];
: : if (R=R+10) or (G=G+10) or (B=B+10) then
: : // Simulate a key press
: : keybd_event(VK_NUMPAD4,0xcb,0 , 0);
: : // Simulate a key release
: : keybd_event(VK_NUMPAD4,0xcb, KEYEVENTF_KEYUP,0);
: : else
: : // do nothing (don't know what to put here for doing nothing though)...
: : end;
: :
: : This is what I have so far. Is it correct and am I missing anything?

: 1. What do you mean by _getRGB[x,y]? It can not be a procedure that you have written yourself, otherwise it would be _getRGB(x,y) that sets the current color values in GLOBAL variables R, G and B that are declared earlier.
: 2. Your IF condition seems a bit strange.
: R=R+10 will never give "true", and the same for G and B. Example: if R is 200, then R+10 is 210; but 200=210 never gives "true"...
: You have to compare R, G and B with global variables that contain the PREVIOUS values:
: if (R>=Rprev+10) or (G>=Gprev+10) or (B>=Bprev+10) then...
: 3. For the ELSE "do nothing" question: just leave out the ELSE part.

Lol sorry about the slow reply. What I want to do is check the color of a pixel at certain location (x, y), and if the pixel is 10% brighter than before the last check then it simulates a key press. Then it checks again, and if the pixel has gotten less bright within a few milliseconds (went back down 10%) it starts the process all over. But if the brightness has stayed the same it simulates another key press and then checks to see if the brightness has gone down, again. I really don't know how to do something like this. Most of what I've read online doesn't help me too much (it's just a shame that Delphi doesn't have a lot of support). Do you think you could point me in the right direction?

Related articles

       

Follow Ups