BeBoP Posted December 8, 2009 Share Posted December 8, 2009 Is is possible to write this code in AU3? This is of course only part of the code but its the part I need to figure out. List<byte> buffer = new List<byte>(); buffer.Add(0x01); // buffer.AddRange(Encoding.ASCII.GetBytes(ownername)); buffer.Add((byte)'\0');// return this.Send(buffer.ToArray(), buffer.Count); This is what I have tried to do but honestly I have no idea what I'm doing. $string = StringToBinary ( "ownername" ) TCPSend($ConnectedSocket,BitAND(0x01,$string,"\0")) Any help greatly appreciated. Link to comment Share on other sites More sharing options...
jvanegmond Posted December 8, 2009 Share Posted December 8, 2009 You obviously have no idea what you are doing. You've confused a variable for a string. Making mistakes at a level that basic are guaranteed ways to ensure no additional help will be provided until you follow a tutorial like Welcome to AutoIt 1-2-3$ownername = "This is a variable containing a string. Simple concept, right? Guess again." $buffer = "0x" ; List<byte> buffer = new List<byte>(); $buffer &= _GetASCIIBytes(Chr(1)) ; buffer.Add(0x01); // $buffer &= _GetASCIIBytes($ownername) ; buffer.AddRange(Encoding.ASCII.GetBytes(ownername)); $buffer &= _GetASCIIBytes(Chr(0)) ; buffer.Add((byte)'\0');// ConsoleWrite($buffer & @CRLF) ; Show output Func _GetASCIIBytes($string) ; Example input: abc $ret = StringToBinary($string, 1) ; Returns 0xDEADBEEF Return StringReplace($ret, "0x", "") ; Returns DEADBEEF EndFunc github.com/jvanegmond Link to comment Share on other sites More sharing options...
BeBoP Posted December 8, 2009 Author Share Posted December 8, 2009 Thanks that really helped a lot. Link to comment Share on other sites More sharing options...
Bert Posted December 8, 2009 Share Posted December 8, 2009 You can also look at the videos for AutoIt on Youtube The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now