I'm almost sure this is possible because I think I can remember a script I ran once did this (I think) but can it be done, by a command or maybe simulating a key press for a shortcut?
I'm almost sure this is possible because I think I can remember a script I ran once did this (I think) but can it be done, by a command or maybe simulating a key press for a shortcut?
Last edited by cathering_; 04-13-2009 at 09:11 PM.
This can be easily done with a procedure that SCAR has:
Usage:scar Code:PickColor(VarColor, VarX, VarY);
PickColor will do the same as SCAR's one, pseudo freezing the screen so you can choose a color.scar Code:Procedure PickColorInfo;
var
Color, X, Y : Integer;
Begin
PickColor(Color, X, Y);
Writeln('You picked ' + IntToStr(Color) + ' at ' + IntToStr(X) + ', ' + IntToStr(Y) + '!');
End;
begin
PickColorInfo;
end.
Okay, thanks for that help!
I have coded and explained an alternative way which will output the color at the current mouse position when F2 is pressed.
SCAR Code:program ColorPicker;
var
x, y: Integer; //Declare needed variables for functions to work.
begin
ActivateClient; //Activates current targeted client.
repeat
repeat
Wait(10); //Repeats waiting 10ms until F2 is pressed.
until IsFKeyDown(2);
GetMousePos(x, y); //Gets current mouse position needed for GetColor.
Writeln('Picked the color ' + IntToStr(GetColor(x, y)) + ' at ' + IntToStr(x) + ', ' + IntToStr(y) + '.');
repeat // ^ Outputs the color at current mouse positon aswell as current mouse position into debug box.
Wait(10) //Repeats waiting 10ms until F2 is unpressed.
until not IsFKeyDown(2);
until False; //Will repeat until program is manually stopped by user.
end.
You will have to select the client window before first running the script.
Hope this helps!
SCAR Code:if (YourActivity = 'ReadingThis') then
Inc(ViewCount);
It's actually for a form I’m making when the user needs to select a colour he/she will click on the specific part of the form and then select it.
Activating a client won't be a problem I assume due to the fact that the form only needs the colour rather than the x-y values. If there was no such procedure such as PickColor; I would have thought that maybe you could simulate a key press for the shortcut key, if any? But since I have an actual procedure (function probably?) there is no need for the shortcut, still appreciate you taking the time to write something though.![]()
Last edited by cathering_; 04-14-2009 at 01:47 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)