Results 1 to 5 of 5

Thread: Colour Picker Form

  1. #1
    Join Date
    Jul 2007
    Location
    UK
    Posts
    307
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default Colour Picker Form

    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.

  2. #2
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This can be easily done with a procedure that SCAR has:
    scar Code:
    PickColor(VarColor, VarX, VarY);
    Usage:
    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.
    PickColor will do the same as SCAR's one, pseudo freezing the screen so you can choose a color.


  3. #3
    Join Date
    Jul 2007
    Location
    UK
    Posts
    307
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Okay, thanks for that help!

  4. #4
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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);

  5. #5
    Join Date
    Jul 2007
    Location
    UK
    Posts
    307
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Gearsnare View Post
    I have coded and explained an alternative way which will output the color at the current mouse position when F2 is pressed.

    You will have to select the client window before first running the script.

    Hope this helps!
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •