Sign in to follow this  
Followers 0
perryhotter

Colour pick an InputBox (need help)

8 posts in this topic

Hi,

I've done a colour picker...

you drive the mouse button over a colour and press F8,

so the colour is first stored in de debug.ini and 2nd its displayed in the field of the inputbox.

I now need to know, how i set it, for example

$colour_use = $coords

So i want, that the colour you picked with ya mouse is set in the variable $colour_use

i always get errors no variable defined

what can i do?

HotkeySet("{F8}","Debug")




Func Debug()
$pos = MouseGetPos()
$coords = ("" & hex(PixelGetColor($pos[0],$pos[1]),6))
FileWriteLine("Debugcords.ini",$coords)
;
Dim $iInputBoxAnswer
$iInputBoxAnswer = InputBox("Colour is displayed here","Your  Hex Colour",$coords,"","-1","-1","-1","-1")
Select
   Case @Error = 0;OK - The string returned is valid

   Case @Error = 1;The Cancel button was pushed

   Case @Error = 3;The InputBox failed to open


EndSelect

EndFunc

$colour_use = $coords

; and than you put it in something like... (but doesn'T work)

If $colour_use = 0xFFFFF Than
.....
....

and how i do that the "0x" is automatically set before the hex colour?

THX

Share this post


Link to post
Share on other sites



Hi,

I've done a colour picker...

you drive the mouse button over a colour and press F8,

so the colour is first stored in de debug.ini and 2nd its displayed in the field of the inputbox.

I now need to know, how i set it,  for example

$colour_use = $coords

So i want, that the colour you picked with ya mouse is set in the variable $colour_use

i always get errors no variable defined

what can i do?

HotkeySet("{F8}","Debug")
Func Debug()
$pos = MouseGetPos()
$coords = ("" & hex(PixelGetColor($pos[0],$pos[1]),6))
FileWriteLine("Debugcords.ini",$coords)
;
Dim $iInputBoxAnswer
$iInputBoxAnswer = InputBox("Colour is displayed here","Your  Hex Colour",$coords,"","-1","-1","-1","-1")
Select
   Case @Error = 0;OK - The string returned is valid

   Case @Error = 1;The Cancel button was pushed

   Case @Error = 3;The InputBox failed to open
EndSelect

EndFunc

$colour_use = $coords

; and than you put it in something like... (but doesn'T work)

If $colour_use = 0xFFFFF Than
.....
....

and how i do that the "0x" is automatically set before the hex colour?

THX

<{POST_SNAPBACK}>

Here is an example using your hotkey and changing a gui background to that color using the F9 key.

#include <GUIConstants.au3>
$coords = 0

HotkeySet("{F8}","Debug")
HotkeySet("{F9}","Show_Color")

$Guid = GUICreate("Color Picker")

GUISetState  ()  

While 1
    Sleep(100)
WEnd

Func Debug()
$pos = MouseGetPos()
$coords = ("" & hex(PixelGetColor($pos[0],$pos[1]),6))
msgbox(0,"","Test")
EndFunc

Func Show_Color()
    GUISetBkColor ("0x" & $coords, $Guid) 
EndFunc

Kerby

Share this post


Link to post
Share on other sites

Okay :-)

this is good... I'm a step wider...

But I have the next Problem,

I use this for a game, where i want to pick the colour,

the game has a normal mouse-Pointer

but

if i move the mouse Pointer over a special place in the game (where i need the colour from) the mouse button changes to an Ingame-Pointer, and with this Pointer I'm not aviable to get the colour (everytime I get the colour 0x000000, instead of a nother)....

so could i force the game to use a standart Windows Mouse-Pointer,

that i could get the colour, or is there another way?

THX

Share this post


Link to post
Share on other sites

Okay :-)

this is good... I'm a step wider...

But I have the next Problem,

I use this for a game, where i want to pick the colour,

the game has a normal mouse-Pointer

but

if i move the mouse Pointer over a special place in the game (where i need the colour from) the mouse button changes to an Ingame-Pointer, and with this Pointer I'm not aviable to get the colour (everytime I get the colour 0x000000, instead of a nother)....

so could i force the game to use a standart Windows Mouse-Pointer,

that i could get the colour, or is there another way?

THX

<{POST_SNAPBACK}>

Well since I haven't tried to do anything with a game. I'm not sure what it would take, but look into MouseGetCursor ( ) to see if you can identify what type of cursor it is. Also I would also add a message box to show the cursor location within the application, is it what you would expect?

Sorry I can't be of more help. :)


Kerby

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

i don't understand

look into MouseGetCursor ( )

(a message box with coordinates i don't need)

i only want to crab a colour from the game,

(but this only works if i get a standart mouse pointer in the game)

Edited by perryhotter

Share this post


Link to post
Share on other sites

Hi,

i don't understand

(a message box with coordinates i don't need)

i only want to crab a colour from the game,

(but this only works if i get a standart mouse pointer in the game)

<{POST_SNAPBACK}>

I understand you don't need the position of the cursor, but some applications can return let's say inaccurate positioning. I was attempting to give you advice on troubleshooting. Sometimes something else can lead you down the right road. MouseGetCursor will return the type of cursor that is being used, it may or may not be helpful.

What I'm trying to say is the color that is returned, is that color in the cursor that is being used? Maybe it's grabbing the cursors color in one location.

I don't know how to set the cursor to a different cursor, it may require a more advanced user to find out. I'd check the help file first.


Kerby

Share this post


Link to post
Share on other sites

hm, okay...

I've trying since many hours what i could do, that it isn't grabbing the cursor color,

but the color of the object....

MouseGetCursor works only in windows... i think...

What I'm trying to say is the color that is returned, is that color in the cursor that is being used? Maybe it's grabbing the cursors color in one location.

indirectly..the cursor is yellow, but I think, that it grabs the cursor colour and not the colour of an object in the game, cauze there is no black thing on the screen....

Share this post


Link to post
Share on other sites

no one knows how to force a game to use the windows cursor?

and... what must i do, if the Windows Programm PAINT should open,

when i exec the script?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0