Functions to convert Hex 2 RGB and vice-versa
- Joel Lipman
- AutoHotkey
- Hits: 9490
- From Hexadecimal to RGB
- From RGB to Hexadecimal
- Check for a valid hexadecimal value
FormatTime( TimeString, Format ) { FormatTime, FormattedTime , TimeString, %Format% return Formattedtime }
FormatAddCommas(val) { Result:=val StringLen, OutputVar, Result NumLoop := (OutputVar // 3) DNum = 3 Loop, % (NumLoop+1) { StringRight,Digit,Result,%DNum% StringReplace, Result, Result, %Digit%,`,%Digit% DNum += 4 } StringLen, OutputVar, Result Loop, %OutputVar% { FirstChar:=Substr(Result, 1, 1) IfEqual, FirstChar, `, { Result:=Substr(Result, 2) } else { break } } Return Result }
Just a quick note for the moment on how to use ternary operators in AutoHotkey. A ternary operator for those who are unfamiliar with this is an "If...Then...Else..." statement written in a small amount of code, usually on one line, and exists in most programming languages.
For Example, the statement:
If (ThisCondition = true) ThisVar:=1 Else ThisVar:=2
Converted to Ternary this would look like:
I'll add as there are a whole bunch of methods using the Ternary Operator in AutoHotkey (discussed on http://www.autohotkey.com/forum/topic29752.html) which I'll put in soon. I just needed something on my site now as I find myself looking for this bit of info every now and again.In this case, I want to display the current month with today highlighted. As I was trying to get my head round writing this in a program using the qHTM.dll (to include HTML in an autohotkey GUI), the calendar will be in a HTML-autohotkey mixed code. Obviously just omit the HTML rubbish if you want to create a calendar using just autohotkey syntax.
Actually, the following code is an excerpt from my program which checks an online server (for IT Events during this month) and if it can't download the calendar, it had to display an offline version in the GUI. To display the following code in this website though, I've had to omit a lot of the HTML part.
Well yes you could just use the Unicode version of Autohotkey. If you're looking for some up and down arrows which is...
What? A quick article on how to create a middleware script which accepts the values from a submitted HTML form and...
Apologies for copying and pasting this but this is information that is worth NOT losing. Tutorial on how to use COM...
Just a quick note as I use this function in various scripts. This adds the 1000th separator comma:...
Couldn't find this anywhere on the net and kinda needed it so am making a note of how to do it here. The issue is that I...
These are for autohotkey and in AHK code. Taken from Autohotkey forums topic 1878: From Hexadecimal to RGB From RGB to...
What's this all about? Well I want the basic hover effect: when my mouse cursor hovers over a link, I want that link...
user windows website would file joomla note time name files code solution first parameter page field license form value function error mysql database system added table create creator where zoho version work find source need following deluge data could list google date display report server script used uploaded order using JoelLipman.Com