Trax

What does AutoIT consider binary number?

3 posts in this topic

I always thought a binary number was a string of zeros and ones like "01001100" but I must be missing something. Binary() and BinaryToString() don't convert it to what I consider a Binary. What does AutoIT consider to be a Binary number?

My ultimate goal is to convert a hex like BFA0D1 to a bit string like 010001101, Is there a function that will do that? 

Share this post


Link to post
Share on other sites



There are various functions on the forum to convert numbers to binary (base 2)
among others you can use _BaseToBase() by @czardas that allows you to convert from/to various bases bidirectionally
That function is included in his math10.au3 udf you can find here: https://www.autoitscript.com/forum/topic/150224-udf-suite/

#include <math10.au3> ; <--- get this udf here: https://www.autoitscript.com/forum/topic/150224-udf-suite/

ConsoleWrite(_BaseToBase("BFA0D1", 16, 2) & @CRLF) ; from base 16 to base 2
ConsoleWrite(_BaseToBase('101111111010000011010001', 2, 16) & @CRLF) ; from base 2 to base 16

 


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

A million thanks Chimp. Just what I was looking for.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now