AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Crazy Scripting : ColorPicker GENIE 1.00
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Fri Aug 04, 2006 9:47 pm    Post subject: Reply with quote

Dear Roland, Very Happy

Thanks for the Credit!

Quote:
TableNavigator - overcards.com The Poker Wiki

Aknowledgements

    Thanks to:

  • Chris Mallett, the primary author of AutoHotkey.

  • Goyyah @ the AHK forum for the amazing Color Picker

  • everyone else at the AHK forum

  • anyone else who has contributed to TableNavigator


Regards, Smile
_________________
Back to top
View user's profile Send private message
Roland



Joined: 08 Jun 2006
Posts: 244

PostPosted: Fri Aug 04, 2006 10:10 pm    Post subject: Reply with quote

Wow, how'd you find that? Shocked

I use it all the time now and really love it. Thanks again. Smile
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Fri Aug 04, 2006 10:15 pm    Post subject: Reply with quote

Roland wrote:
Wow, how'd you find that? Shocked


I googled for "goyyah"

http://www.google.co.in/search?q=goyyah&hl=en&lr=&as_qdr=all&start=10&sa=N

Roland wrote:
I use it all the time now and really love it. Thanks again. Smile


It was nice to see my code put to real use! Thanks! Very Happy

Regards, Smile
_________________
Back to top
View user's profile Send private message
Roland



Joined: 08 Jun 2006
Posts: 244

PostPosted: Fri Aug 04, 2006 10:53 pm    Post subject: Reply with quote

Quote:
I googled for "goyyah"


So apparently you are a heathen woman. Confused

It's pretty awesome that Rajat's tutorial has been translated into Chinese btw. Exclamation
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Fri Aug 04, 2006 10:59 pm    Post subject: Reply with quote

Roland wrote:
So apparently you are a heathen woman. Confused


No way! Laughing You think I am a woman?

See this Post: Why have you choosen this Nickname ?

Regards, Smile
_________________
Back to top
View user's profile Send private message
Roland



Joined: 08 Jun 2006
Posts: 244

PostPosted: Fri Aug 04, 2006 11:17 pm    Post subject: Reply with quote

Ah, I see. Smile
Back to top
View user's profile Send private message
Icarus



Joined: 24 Nov 2005
Posts: 500

PostPosted: Fri Jul 13, 2007 7:00 am    Post subject: Reply with quote

Very nicely done.
I am building an automatic "INI2GUI" utility, that reads INI file and displays it in a dynamically created options-like tabbed GUI.

I was looking for a picker in the help file, hoping to find the standard windows color picker, and was disappointed it was not available - but this picker is a great piece of code.

I only changed some minor stuff for my needs:
1. Instead of Gui 4, I used a higher number
2. When Gui 1 is found, in addition to +Owner, I use +Disabled on GUI 1 and then -Disabled when the picker is closed.
3. Changed "Okay" to "OK"

Really really helpful.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Fri Jul 13, 2007 2:42 pm    Post subject: Reply with quote

Dear Icarus, Smile

Thanks for the feedback but this color picker wrapper is a bit overdone and I suggest you to call the windows Standard ChooseColor dialog.
I suggest you to use my ChooseColor() function which can save custom colors and also visit CmnDlg 2.0 - Common Dialogs for StdLib by Majkinetor

Smile
Back to top
View user's profile Send private message
Icarus



Joined: 24 Nov 2005
Posts: 500

PostPosted: Sat Jul 14, 2007 7:01 am    Post subject: Reply with quote

Skan

You are the best.
Your choose color is indeed nicer, although I like the stuff you did in the Color Picker as well.

I will definitely check out the stdlib.

Thanks again.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
daniel2



Joined: 23 Jul 2007
Posts: 47

PostPosted: Wed Aug 01, 2007 9:36 pm    Post subject: Reply with quote

This is an excellent tool.. & I wish I wouldn't have overlooked it; There are numerous projects just in the past year where this would have saved me a tremendous amount of time!

Definately going to be a permanent part of my DEVEL toolbox! Thanks for sharing (& pointing out to me no less..) Very Happy
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Wed Aug 01, 2007 9:53 pm    Post subject: Reply with quote

Thanks for the nice words Daniel! Very Happy
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 22

PostPosted: Thu Jul 03, 2008 9:40 am    Post subject: A few updates Reply with quote

I've updated the code a bit for my use, and i figured i'd post my updates in case anybody else finds it useful

Quote:
Changelog:
+ *New Feature* Recognizes RGB(x,y,z) values now, and displays a box with that color for a few seconds
I wrote this feature to be able to quickly preview a color from text when programming
you can add your own custom code for it as well.
- added a new function to show a color for a short time
- moved old code to function for choosing a new color
- fixed bugs for not correctly parsing # or c prefixed colors


I have only changed the ColorPicker_GENIE.ahk file, so just replace that file with this one. It maintains all the previous features.

Code:

/*  * * * * * * * * * * * * * * * * * * * * * * * * * * * *

      Disclaimer:

      I do not foresee any risk in running this script but
      you may run this file "ONLY" at your own risk.

      * * * * * * * * * * * * * * * * * * * * * * * * * * * *

File Name   : ColorPicker_GENIE.ahk       Version : 1.00 Beta


Main Title  : AutoHotkey Helper App
Sub Title   : ColorPicker GENIE
Posted @    : http://www.autohotkey.com/forum/viewtopic.php?p=57968#57968


Description : "ColorPicker GENIE" is a Clipboard monitoring utility that waits until
                     the Clipboard contains a Valid Color Code and when finds one - pops up
                     the ColorPicker Utility.

                     Amidst AHK Scripting, one may find a requirement to pick a suitable color
                     for a GUI background, Text Control etc.

                     With "ColorPicker GENIE" running in the System Tray, life will be easier.         
                     
                     To Insert a Color Code : Press Control+Win+Insert ... and the
                     ColorPicker Pops up. Select a Color and Press okay ... you're done.

                     To Replace/Preview a Color code :
                     Double Click on the Color Code - Right Click - Copy ... and the
                     ColorPicker Pops up. Select a Color and Press okay ... you're done.

                     Supported prefixes for Color Codes are "c" and "#"

                     For eg. HEX code for "White color" will be detected when put in Clipboard as

                     FFFFFF
                     cFFFFFF
                     #FFFFFF

                     When AHK Scripting - "Double clicking" is enough for selecting the Color code.
                     The leading or trailing spaces will be taken care of. The GENIE pastes back the
                     edited Color code with exact number of leading/trailing spaces as found in clipboard.

                     Double clicking the "Tray Icon" will Pause/Resume the script. However manual insertion
                     is always possible with hotkey Control+WIN+Insert.

                     Though written as a "Helper App" for/in AutoHotkey, this utility will be helpful for
                     editing Color codes contained in HTML.

                     New Feature by Vixay:
                        Will show a preview of the color when you copy text like the following
                        RGB(x,y,z)

                     This Script requires ColorPicker.ahk for functioning.
                     
Author      : A.N.Suresh Kumar aka "Goyyah"
Email       : arian.suresh@gmail.com

Created     : 2006-03-22
Modified    : 2008-07-03
Modified by : Vixay Xavier
Version     : 1.00 Beta

Scripted in : AutoHotkey Version 1.0.43.04 , www.autohotkey.com


*/

#SingleInstance, Force
#Persistent
AutoTrim, On
SetKeyDelay -1,-1
ClipboardOption=Disabled
WindowTitle = ColorPicker Genie

Menu, Tray, NoStandard
Menu, Tray, UseErrorLevel, On
Menu, Tray, Icon, CPG1.ico,, 1
Menu, Tray, Add, &Insert Color Code`t[Ctrl+Win+Insert], InsertColorCode
Menu, Tray, Add, &Genie`t[Ctrl+Win+Break], Pausee
Menu, Tray, Add,
Menu, Tray, Add, View &Colors.htm, Colors.HTM
Menu, Tray, Add,
Menu, Tray, Add, &Reload Script, Reloadd
Menu, Tray, Add, &Exit %WindowTitle%, Exitt
Menu, Tray, Tip, %WindowTitle% - Running
Menu, Tray, Default, &Genie`t[Ctrl+Win+Break]
Menu, Tray, Check, &Genie`t[Ctrl+Win+Break]

SetTimer CheckClipBoard,10
Return

^#CtrlBreak::GoSub, Pausee
^#Insert::GoSub, InsertColorCode

CheckClipBoard:

   SetTimer CheckClipBoard,OFF

   Winget,Win_ID,ID,A
   OClip:=Clipboard
   ClipText=%OClip%

   ;better idea is to store previous clipboard, and if it's the same, don't run?
   ;don't process clipboard if it's the same as before
   ; DOESN"T work as of now
   if PrevClip == ClipText
   {
      return
   }
   else
   {
      PrevClip := ClipText
   }
      
   If StrLen(ClipText)=6
      {
         checkNShowColor(ClipText)
      }
   else If StrLen(ClipText)=7
      {
         StringLeft, FChar, ClipText, 1, 1
         If (FChar=="#" or FChar=="c")
            {
               StringTrimLeft, ClipText, ClipText, 1
               checkNShowColor(ClipText)
            }
      }
      ;RGB(x,y,z) 10 - 16 RGB(xxx,yyy,zzz)
      else If StrLen(ClipText)>=10 && StrLen(ClipText)<=16
      {
         ;FoundPos := RegExMatch(ClipText, "i).*rgb\((\d+),(\d+),(\d+)\).*", srgb)  ; Returns 1 because a match was achieved via the case-insensitive option.
         ;FoundPos := RegExMatch(ClipText, "i).*rgb\((\d+,\d+,\d+)\).*", srgb)  ; Returns 1 because a match was achieved via the case-insensitive option.
         ;do a case insensitive search for RGB() in text, and save the pattern/values within parenthesis to string srgb1
         FoundPos := RegExMatch(ClipText, "i).*rgb\((.*)\).*", srgb)
         ;FoundPos := RegExMatch(ClipText, "i).*value\=\"(.*)\".*", srgb)
         If FoundPos <> 0
         {
            ;conver rgb decimal string to hex values
            hrgb := RGB2HEX(srgb1)
            ;MsgBox, %srgb1% = %hrgb%
            ;checkNShowColor(hrgb)
            ShowColorWindow(hrgb, 3000)
            ;erase clipboard so we don't run this function again! else we'll be stuck in a loop
            Clipboard:=
            ;better idea is to store previous clipboard, and if it's the same, don't run?
         }
      }

   If A_IconTip = %WindowTitle% - Running
      SetTimer, CheckClipBoard, 250

Return

InsertColorCode:

      Winget,Win_ID,ID,A

      HexC_IM:=ColorPicker(Clipboard,WindowTitle " - Insert Mode")
   
      If HexC_IM <>
      {
         WinActivate, ahk_id %Win_ID%
         SendRaw, % HexC_IM
      }
Return

Pausee:
   If A_IconTip=%WindowTitle% - Running
      {
         Menu, Tray, Tip, %WindowTitle% - Dormant
         Menu, Tray, UnCheck, &Genie`t[Ctrl+Win+Break]
         Menu, Tray, Icon, CPG0.ico,, 1
         SetTimer CheckClipBoard, OFF
      }
   Else
      {
         Menu, Tray, Tip, %WindowTitle% - Running
         Menu, Tray, Check, &Genie`t[Ctrl+Win+Break]
         Menu, Tray, Icon, CPG1.ico,, 1
         SetTimer CheckClipBoard,10
      }

Return


Reloadd:
Reload
Return

Exitt:
ExitApp
Return

Colors.HTM:
Run, Colors.HTM
Return

; shows a Square window displaying the color provided for the amount of time specified (in ms)
ShowColorWindow(colHex, msdelay)
{
   Progress, m2 b fs18 zh0 cw%colHex% H50 W50 X%A_CaretX% Y%A_CaretY%
   Sleep, msdelay
   Progress, Off
}
; opens color picker
checkNShowColor(colHex)
{
      ;global vars to enable typing back of values
      global OClip
      global Win_ID
      ValidColor:=CheckHexC(colHex)
      If ValidColor
         {
            ;ShowColorWindow(colHex, 1000)
            ;show the color window with the current color selected
            HexC:=ColorPicker(colHex,WindowTitle " - Insert Mode (Auto)")
            ; if user selects a color and clicks OK
            ;erase clipboard so we don't run this function again! else we'll be stuck in a loop
            Clipboard:=
            ;better idea is to store previous clipboard, and if it's the same, don't run?
            
            If HexC <>
            {
               ;activate original window from which text was copied
               WinActivate, ahk_id %Win_ID%
               ; replace the old color with new color in the original clipboard
               ; will work with only HEX colors!!
               StringReplace, OClip, OClip, % colHex, % HexC
               ; send the output to the window
               SendRaw, % OClip
            }
            
         }
}

#Include ColorPicker.AHK
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Thu Jul 03, 2008 10:03 am    Post subject: Reply with quote

Thanks Vixay Very Happy, I have updated the Title-Post with a link to your post. Smile
_________________
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Oct 27, 2008 2:00 am    Post subject: Reply with quote

hey you will be relases 2.o?
Back to top
Guest






PostPosted: Mon Oct 27, 2008 2:12 am    Post subject: Reply with quote

Anonymous wrote:
hey you will be relases 2.o?

look at this i will wish to see it in 2.0

http://www.2createawebsite.com/build/hex-colors.html
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group