crystalburner Posted July 31, 2006 Posted July 31, 2006 i need to write a single string to a file as unicode text anyone have any idea as autoit just seems to write ascii with the filewrite commands C
evilertoaster Posted July 31, 2006 Posted July 31, 2006 Raw write the values directly. Use FileOpen in RawMode and then write them as a binary string... If you need an example i can show you.
crystalburner Posted July 31, 2006 Author Posted July 31, 2006 Raw write the values directly. Use FileOpen in RawMode and then write them as a binary string... If you need an example i can show you.Um i think i do!www.ascii2binaryconverter.com?
evilertoaster Posted July 31, 2006 Posted July 31, 2006 $Example=FileOpen(@ScriptDir&"\example.txt",2) ;Opens File RawWrite($Example,"FFFE6100") ;Writes Hex to the file. FFFE6100 is the unicode code for the letter 'a' FileClose($Example) Func RawWrite($File,$Hex) If IsInt(StringLen($Hex)/2)=0 Then Return (-1) Local $a For $a=1 To StringLen($Hex) Step 2 FileWrite($File,Chr(Dec(StringMid($Hex,$a,2)))) Next EndFunc This will write the letter 'a' to example.txt in the run directory in unicode.
crystalburner Posted July 31, 2006 Author Posted July 31, 2006 $Example=FileOpen(@ScriptDir&"\example.txt",2) ;Opens File RawWrite($Example,"FFFE6100") ;Writes Hex to the file. FFFE6100 is the unicode code for the letter 'a' FileClose($Example) Func RawWrite($File,$Hex) If IsInt(StringLen($Hex)/2)=0 Then Return (-1) Local $a For $a=1 To StringLen($Hex) Step 2 FileWrite($File,Chr(Dec(StringMid($Hex,$a,2)))) Next EndFunc This will write the letter 'a' to example.txt in the run directory in unicode.fuck me this is going to be tricky! "JET " & @computername & "\Microsoft Information Store\First Storage Group\" !!
evilertoaster Posted August 1, 2006 Posted August 1, 2006 Made you a present. Look at http://www.autoitscript.com/forum/index.php?showtopic=30149It's not to tricky and you can modify it to suit your specific needs.
crystalburner Posted August 1, 2006 Author Posted August 1, 2006 Made you a present. Look at http://www.autoitscript.com/forum/index.php?showtopic=30149 It's not to tricky and you can modify it to suit your specific needs. cool #include <constants.au3> #NOTRAYICON #include <file.au3> $raw="JET " & @computername & "\Microsoft Information Store\First Storage Group\" $string=Asc2Unicode($raw) $file=fileopen(@ScriptDir & "\exchange.bks",2) FileWrite($file,$string) fileclose($file) exit Func Asc2Unicode($AscString, $addBOM = false) Local $BufferSize = StringLen($AscString) * 2 Local $FullUniStr = DllStructCreate("byte[" & $BufferSize + 2 & "]") Local $Buffer = DllStructCreate("byte[" & $BufferSize & "]", DllStructGetPtr($FullUniStr) + 2) Local $Return = DllCall("Kernel32.dll", "int", "MultiByteToWideChar", _ "int", 0, _ "int", 0, _ "str", $AscString, _ "int", StringLen($AscString), _ "ptr", DllStructGetPtr($Buffer, 1), _ "int", $BufferSize) DllStructSetData($FullUniStr, 1, 0xFF, 1) DllStructSetData($FullUniStr, 1, 0xFE, 2) If $addBOM then Return DllStructGetData($FullUniStr, 1) Else Return DllStructGetData($Buffer, 1) Endif EndFunc Func __CharacterIsApha($s_Str); check string is alpha Local $a_Alpha = "abcdefghijklmnopqrstuvwxyz" Return (StringInStr($a_Alpha, $s_Str)) EndFunc ;==>__CharacterIsApha
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