What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » WriteDWORD - sending hex value from 3 decimal values

WriteDWORD - sending hex value from 3 decimal values
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: WriteDWORD - sending hex value from 3 decimal values
Noes! You do know that eval() is evil? :O
You can simply use parseInt() on the different parts and choose 16 as base. This way, JScript will convert the string itself from hexadecimal to a decimal number. ;)
code:
var sColor = "#001122";
var r = parseInt(sColor.substr(1, 2), 16);
var g = parseInt(sColor.substr(3, 2), 16);
var b = parseInt(sColor.substr(5, 2), 16);

var color = (b<<16) + (g<<8) + r;

CHOOSECOLOR.WriteDWORD(12, color);

This post was edited on 12-10-2007 at 12:14 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-10-2007 11:47 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
WriteDWORD - sending hex value from 3 decimal values - by MeEtc on 12-09-2007 at 09:04 PM
RE: WriteDWORD - sending hex value from 3 decimal values - by ShawnZ on 12-09-2007 at 09:23 PM
RE: WriteDWORD - sending hex value from 3 decimal values - by MeEtc on 12-09-2007 at 09:56 PM
RE: WriteDWORD - sending hex value from 3 decimal values - by Matti on 12-10-2007 at 11:47 AM
RE: WriteDWORD - sending hex value from 3 decimal values - by Felu on 12-10-2007 at 11:52 AM
RE: WriteDWORD - sending hex value from 3 decimal values - by Matti on 12-10-2007 at 12:10 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On