Jump to content

How to BitConverter in autoit


Recommended Posts

Hello guys.

I'm new to AutoIt world. I'm trying to convert my c# code to auto it. 

How can I do it in AutoIt I didn't see any function similar to 'BitConverter'


            byte[] data = new byte[10];
            byte[] fourBytes = BitConverter.GetBytes(data.Length);
            Console.WriteLine(fourBytes.Length); // 4

            int getLength = BitConverter.ToInt32(fourBytes, 0);
            Console.WriteLine(getLength); // 10



Link to comment
Share on other sites

Hex is quite close, you just need to convert it to array after, if needed...

#include <Constants.au3>

MsgBox ($MB_SYSTEMMODAL,"Bool",Hex(True,2))
MsgBox ($MB_SYSTEMMODAL,"Char",Hex(AscW("*"),4))
MsgBox ($MB_SYSTEMMODAL,"Word",Hex (11111,4))
MsgBox ($MB_SYSTEMMODAL,"Int",Hex (1111111111))
MsgBox ($MB_SYSTEMMODAL,"Long",Hex(1111111111111111111))
MsgBox ($MB_SYSTEMMODAL,"Float",Hex(0.111111111111111))


Link to comment
Share on other sites

;create struct
$struct =dllstructcreate("int;float[4];dword")

;fill struct with data

;read some data from struct at offset 4


Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...