Page 1 of 6

PasteColor

Posted: Tue Sep 04, 2012 4:16 pm
by billon
Moderator note: this thread is split from it's original posting:


---

tproli, i don't know is that what you realy need, but may be it help you - Colors MiniLab (leelusoft.blogspot.com)-potable and stealth, and Pipette (sttmedia.com/pipette)-port'n'stealth too. Or ColorMan (cgs.vdsworld.com)-port'n'(i hope)stealth.

Re: Portable Software that hasn't been developed?

Posted: Tue Sep 04, 2012 8:02 pm
by tproli
PasteColor
Color Copy Paste Tool for the Windows Color Picker
pastecolor-screenshot.png
PasteColor is a Windows color picker helper tool that helps you copy or paste color values easily.
Written in AutoIt.

More Information
Download

-----------------------------------------------

Thanks, but what I need is not a color picker. Many applications use the windows color picker and there is only a few solutions to replace it (e.g. http://www.joviancolorpicker.com/, but it's payware).

I can get a color by shift-clicking on a pixel in IrfanView. That puts the color in hex format in the clipboard. I would like to use this color data to quickly paste in the standard windows color picker (which has no option to input the hex color format).

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 7:20 am
by tproli
Update: I had some time to play and PasteColor (wip name) is in alpha/beta version:

http://rolandtoth.hu/files/PasteColor.zip

I got an issue with StringRegExp, I cannot make [:xdigit:] work properly. I needed to ensure that clipboard contents has only hex values (0-9, a-f, A-F), and if it is not the case, show an error message.

Code: Select all

Local $array = StringRegExp($color, '^[0-9a-fA-F]+$', 1)

If @error = 2 Then
    ShowError()
EndIf
If someone could look at it that would be great. The zip contains the source file, there you can see this in 46-50 (commented out).

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 7:55 am
by guinness
AutoIt? I will have a look.

Edit: Is this what you are looking for >> http://www.autoitscript.com/forum/topic ... r-picking/

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 8:08 am
by guinness
Sorry but why not use StringIsXDigit?

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 8:12 am
by guinness
And here is the update to your SRE.

Code: Select all

ConsoleWrite('Return: ' & _IsHexColor('FF00FF') & @CRLF)
ConsoleWrite('Return: ' & _IsHexColor('FF00HH') & @CRLF)

Func _IsHexColor($bColor) ; By guinness, Returns True or False.
	Return (StringRegExp($bColor, '[0-9a-fA-F]{6}', 0) = 1 And StringLen($bColor) = 6)
EndFunc   ;==>_IsHexColor

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 10:48 am
by tproli
StringXDigit could have been useful if I had known about it :)

Finally I used this:

Code: Select all

If StringRegExp($color, '\b[0-9a-fA-F]{6}\b', 0) = 0 Then
        ShowError()
    EndIf
The word boundaries ("\b") seems to eliminate the need of StringLen.

Thanks for your help!

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 11:11 am
by guinness
I would say StringIsXDigit is a better option though. Oh, forgot about /b, SREs are tricky little things as you know, good thing they are universal in most programming languages, so you don't need to re-learn everytime.

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 12:39 pm
by tproli
I wonder if something like this would be possible to do in AutoIt:

Image

That is, an "extension" to the standard Windows color picker, that has two options: copy current color (from the Red-Green-Blue input fields), and to paste color on clipboard (if any). This would require the application to run in the background and be shown only if the color picker is visible - this can be tricky because it is not a separate application. I tried to figure out a unique handler for the color picker but with no success, they were different in different applications. This doesn't mean there's no such thing though :)

I also wonder why aren't these features built-in to the OS.

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 12:48 pm
by guinness
Why not have a look at _ChooseColor in the help file.

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 1:07 pm
by tproli
I don't think you got it. There are applications that use the built-in windows color picker. There's no way to change it.

Think about customizing color in applications, e.g. the font color in Total Commander:

Image

In such cases you don't have an option to use a 3rd party picker.

Problem is when you need to input a specific color:

- it is not convenient to type 3 times up to 3 digit numbers to the R-G-B fields
- you have your color only in hex format: you cannot enter it
- you would like to copy a color that you just selected: no such feature, you have to memorize R-G-B digits

See this discussion:
http://superuser.com/questions/342921/i ... lor-picker

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 6:26 pm
by webfork
tproli wrote:you would like to copy a color that you just selected: no such feature, you have to memorize R-G-B digits
The closest thing (and still quite far) I've seen is ArsClip form entry mode (paste item 1 {tab} paste item 2 {tab} paste item 3 and that would only work for a set number of colors that you prep in advance. I couldn't find anything on setting the default colors.

If you find something for this, I'm also interested. Would make some of the presentation work I do go a lot faster.

Re: Portable Software that hasn't been developed?

Posted: Wed Sep 05, 2012 9:46 pm
by tproli
If you find something for this, I'm also interested.
The PasteColor I made does this. Currently supports hex color as input (e.g. #0099FF) and pastes the corresponding rgb values to the color picker. It could be easily modified to accept rgb as input (0,153,255).

The copy functionality would also be easy to add.

In this demo the clipboard has "#0099FF", then I moved the cursor to the "Red" input field and hit a hotkey (ctrl+shift+P), that launched PasteColor (I made a regular Windows shortcut and set this hotkey). PasteColor then converts the hex value to rgb and pastes in the fields (sends Red-TAB-Green-TAB-Blue just like ArsClip).

Image

So the functionality is practically ready but if I could make a panel that is visible each time the color picker pops up, that would simplify its usage (would be more user-friendly).

Re: Portable Software that hasn't been developed?

Posted: Thu Sep 06, 2012 6:57 am
by tproli
Here is an update:

http://rolandtoth.hu/files/PasteColor.zip

Usage
1. Assign a hotkey to PasteColor.exe (e.g. create a shortcut and set a hotkey)
2. Put the cursor in the "Red" field of the Windows color picker and invoke PasteColor's hotkey
3. In the pop-up input box enter the hex color value. You can use 3 or 6 digit value with or without the hash mark. The input box is pre-filled with clipboard data.

Changes
- added input box for hex color input: ability to enter custom hex color or cancel the process

I don't plan new features unless someone asks for them. Perhaps adding RGB input, that may come handy.

Re: Portable Software that hasn't been developed?

Posted: Thu Sep 06, 2012 8:33 am
by guinness
I know I missed the mark on your problem, so I thought I would provide you with this function which might be of use to you.

Code: Select all

ConsoleWrite('Return True: ' & _IsHexColor('FF00FF') & @CRLF)
ConsoleWrite('Return False: ' & _IsHexColor('FF00HH') & @CRLF)
ConsoleWrite('Return True: ' & _IsHexColor('0xFF00FF') & @CRLF)
ConsoleWrite('Return False: ' & _IsHexColor('0xFF00HH') & @CRLF)
ConsoleWrite('Return True: ' & _IsHexColor('#FF0000') & @CRLF)
ConsoleWrite('Return False: ' & _IsHexColor('#FF00J0') & @CRLF)

; Accepts the following formats:
; 0xFFFFFF
; FFFFFF
; #FFFFFF
Func _IsHexColor($bColor) ; By guinness, Returns True or False.
	Return StringRegExp($bColor, '\b(0x|#)?[0-9a-fA-F]{6}\b', 0) = 1
EndFunc   ;==>_IsHexColor