lafafmentvotre Posted April 8, 2007 Share Posted April 8, 2007 Hello Sorry by advance for my bad english. I want to convert a string to a hex string. I use this script : #include <string.au3> $text = _StringToHex(@UserName) MsgBox(0, "New string is", $text) but after , i want to insert Between every caracters the value "00" (double zero) to use in a REG_BINARY : RegWrite("HKCU\Software\Microsoft\Office\8.0\Common\UserInfo", "UserName", "REG_BINARY", "" & $Text) because this REG_BINARY use 00 between every caracters. My result for lafafmentvotre is : 6C616661666D656E74766F747265 the result to obtain is : 6C0061006600610066006D0065006E00740076006F00740072006500 I dont find the function to do this (i see stringreplace but i'm not shure it's the good function to do this). Else, this script must match with every string. Thanks for help. Link to comment Share on other sites More sharing options...
Obi-w00t Posted April 8, 2007 Share Posted April 8, 2007 #include <string.au3> $string = @UserName $len = StringLen($string) Global $text For $i = 1 to $len $text &= _StringToHex(StringMid($string,$i,1)) & "00" Next MsgBox(0, "New string is", $text) I think that should work. Link to comment Share on other sites More sharing options...
lafafmentvotre Posted April 8, 2007 Author Share Posted April 8, 2007 You think true. thanks for help. I just add "0000" at the end of value like this : #include <string.au3> $string = @UserName $len = StringLen($string) Global $text For $i = 1 to $len $text &= _StringToHex(StringMid($string,$i,1)) & "00" Next MsgBox(0, "New string is", $text) RegWrite("HKCU\Software\Microsoft\Office\11.0\Common\UserInfo", "UserName", "REG_BINARY", "" & $text & "0000") Really thanks Link to comment Share on other sites More sharing options...
Obi-w00t Posted April 8, 2007 Share Posted April 8, 2007 May I ask what kind of program you are making that would need to write to "HKCU\Software\Microsoft\Office\11.0\Common\UserInfo\UserName" ? 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