Re: automation

Posted by Fred Green p15901 on August 06, 2008

In Reply to A little automation help please... posted by Godfather on July 29, 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.

Related articles


Follow Ups