## Hex To Decimal

Technical support and scripting issues

Moderators: JRL, Dorian Ellis

### Hex To Decimal

Hello Everyone,

I have something in mind for this macro. Until today, I had NO idea how to do this. Now I have learned how and I wrote a macro that I hope will be usefull to some of you.

ENJOY!!

This macro prompts for a hex number and then calculates what the decimal number is.
Code: Select all
``let>NewValue=let>matches=0let>pwr=0let>Total=0let>asd=0let>simi=;Input>Hex,Enter a HEX valueUpperCase>Hex,HexRegEx>[0-9a-fA-F],Hex,0,Hexidecimal,matches,0Repeat>matcheslet>Temp=Hexidecimal_%matches%ConCat>NewValue,TempConCat>NewValue,simisub>matches,1Until>matches=0RegEx>;\$,NewValue,0,Values,nm,1,,NewValueStringReplace>NewValue,A,10,NewValueStringReplace>NewValue,B,11,NewValueStringReplace>NewValue,C,12,NewValueStringReplace>NewValue,D,13,NewValueStringReplace>NewValue,E,14,NewValueStringReplace>NewValue,F,15,NewValueSeparate>NewValue,;,Valuelet>Count=%Value_count%Repeat>asdadd>asd,1let>hx={Power(16,%pwr%)}let>digit=Value_%asd%let>eq=%digit%*%hx%let>Total=%Total%+%eq%add>pwr,1Until>asd=%Count%mdl>%Total%``

Later, I plan to post a macro to do the opposite. Decimal to Hex.

PepsiHog
MS v12 WinXP sp3

PepsiHog. Yep! I drink LOTS of Pepsi! AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

PepsiHog
Macro Veteran

Posts: 283
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida