Is there a way to check if the user has targeted the client? Would be nice to check and gracefully exit if no client targeted.
Is there a way to check if the user has targeted the client? Would be nice to check and gracefully exit if no client targeted.
If you use SMART then it will automatically be targeted. I dont know why you wouldnt be using it for an rs script. Maybe for something else? If so, you could check for a colour that will always be there, because the coords will be different if the right client isn't targeted.
procedure FindWindow(Title: string);
Finds Client window with specified title. Character case of Title must match that in window title exactly.
I believe you are looking for. Maybe FindWindowBySize could be used too.
Here is a list of all the client control functions though:
SCAR Code:procedure FindWindow(Title: string);
Finds Client window with specified title. Character case of Title must match that in window title exactly.
function FindWindowTitlePart(Title: string; CaseSensitive: Boolean): Boolean;
Finds window that contains text specified by Title parameter in window caption.
function FindWindowBySize(Width, Height: Integer): Boolean;
Finds window with specified size.
procedure ActivateClient;
Activate client window.
function GetClientWindowHandle: Integer;
Get Windows handle value of active client window.
procedure SetClientWindowHandle(H: Integer);
Set active client window to handle H.
Example:
H:= GetClientWindowHandle;
//specify another client window
FindWindow('Debug Image');
...
//return to previous client
SetClientWindowHandle(H);
procedure SetDesktopAsClient;
Sets the desktop (default window) as selected client.
procedure SetTargetBitmap(bitmap: Integer);
Sets bitmap as target for all color/bitmap searching functions. After calling SetTargetBitmap all functions won't be working with client but with specified bitmap.
Example:
SetTargetBitmap(flagstaff);
if(FindColor(x, y, $000066, 0, 0, 3, 2))then
...
The sample above will not search on client screen but in bitmap "flagstaff" instead.
procedure GetClientDimensions(var Width, Height: Integer);
Get client width and height.
procedure CopyClientToBitmap(bitmap: Integer; xs, ys, xe, ye: Integer);
Copy client screen part to bitmap specified.
procedure SetTargetDc(Dc: HDC);
Sets and external device context as target for SCAR's colorfinding functions.
function GetTargetDC: HDC;
Returns the DC of the currently selected window/bitmap.
procedure ResetDc;
Sets the device context of SCAR's selected window as target for SCAR's colorfinding functions.
function GetBitmapDc(Bmp: Integer): HDC;
Returns the device contect of the entered bitmap.
Last edited by JAD; 08-28-2009 at 08:07 AM.
K. Thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)