carl1905

BinaryToString for unsupported language. [Solved]

18 posts in this topic

#1 ·  Posted (edited)

Hi. I'm looking forward to adding another language option for BinaryToString.

Basically, it only supports ANSI, UTF-8,  UTF16 Little Endian, and  UTF16 Big Endian. https://www.autoitscript.com/wiki/BinaryToString

Is there any way to adding Shift-JIS(Japanese, CP 932) and EUC-KR(Korean, CP 949)?

Edited by carl1905

Share this post


Link to post
Share on other sites



These are ANSI codepages which will be supported iff your system is setup for such support. Which binary encoding is used in your input? UTF8, UTF16-LE, UTF16-BE?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
39 minutes ago, jchd said:

These are ANSI codepages which will be supported iff your system is setup for such support. Which binary encoding is used in your input? UTF8, UTF16-LE, UTF16-BE?

Hi, jchd.

The one that I want to do it is, extract text from *.dat files. These are script files which is written by Shift-JIS (Japanese).

Image

I made a tool to extract the text. However, BinarytoString doesn't support change binary to Shift-JIS.

$Str = BinaryToString("0x" & StringRegExpReplace($Str,"0x",""),5)

There are no Global Const for Shift-JIS in StringConstants.au3. There are only ANSI, UTF16LE/BE, and UTF-8.

Global Const $SB_ANSI = 1
Global Const $SB_UTF16LE = 2
Global Const $SB_UTF16BE = 3
Global Const $SB_UTF8 = 4

However, I'm look forward to add it if it is possible.

Global Const $SB_Shift_JIS = 5

 

Share this post


Link to post
Share on other sites

You can't do it that way. Rather try this:

#include <FileConstants.au3>

Global Const $CP_SHIFT_JIS = 932

; get your JIS input from full binary file
Local $hInp = FileOpen("Shift-JIS.txt", $FO_BINARY)
Local $Inp = FileRead($hInp)
FileClose($hInp)

; or fake it as in your example
$Inp = Binary("0x8366815B835E82CC835F83458393838D815B836882C98EB8947382B582DC82B582BD42")
Local $tInp = DllStructCreate("byte[" & BinaryLen($Inp) & "]")
DllStructSetData($tInp, 1, $Inp)

Local $sJIS = _CodepageStructToString($tInp, $CP_SHIFT_JIS)
MsgBox(0, "JIS text", $sJIS)

Func _CodepageStructToString($tText, $iCodepage)
    Local $aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", DllStructGetSize($tText), _
                                "ptr", 0, "int", 0)
    Local $tWstr = DllStructCreate("wchar[" & $aResult[0] & "]")
    $aResult = DllCall("Kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", DllStructGetSize($tText), _
                        "struct*", $tWstr, "int", $aResult[0])
    Return DllStructGetData($tWstr, 1)
EndFunc

 


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

On 2016. 4. 20. at 10:09 AM, jchd said:

You can't do it that way. Rather try this:

#include <FileConstants.au3>

Global Const $CP_SHIFT_JIS = 932

; get your JIS input from full binary file
Local $hInp = FileOpen("Shift-JIS.txt", $FO_BINARY)
Local $Inp = FileRead($hInp)
FileClose($hInp)

; or fake it as in your example
$Inp = Binary("0x8366815B835E82CC835F83458393838D815B836882C98EB8947382B582DC82B582BD42")
Local $tInp = DllStructCreate("byte[" & BinaryLen($Inp) & "]")
DllStructSetData($tInp, 1, $Inp)

Local $sJIS = _CodepageStructToString($tInp, $CP_SHIFT_JIS)
MsgBox(0, "JIS text", $sJIS)

Func _CodepageStructToString($tText, $iCodepage)
    Local $aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", DllStructGetSize($tText), _
                                "ptr", 0, "int", 0)
    Local $tWstr = DllStructCreate("wchar[" & $aResult[0] & "]")
    $aResult = DllCall("Kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", DllStructGetSize($tText), _
                        "struct*", $tWstr, "int", $aResult[0])
    Return DllStructGetData($tWstr, 1)
EndFunc

 

Hmm.. I'm not sure how to adjust your code for my code.

Sample file

Here is my au3 code for extract text from *.dat file. It works well for English.dat. But it doesn't work for Japanese.dat file.

#include <FileConstants.au3>

Global Const $CP_SHIFT_JIS = 932

$Path = FileOpenDialog("Select the dat file", @ScriptDir, "dat files (*.dat)",1)
If @error = 1 Then Exit
$File = fileopen($Path,16)
$Name = CompGetFileName($Path)
$Id = FileRead($File,2)
If $Id <> "XL" Then
    MsgBox(0,"Error!",'Wrong id: "'&BinaryToString($Id)&'"'&@CR&'Expected: "XL"')
    Exit
 EndIf
 FileSetPos($File,8,0)
 $Files = FileRead($File,2)
 FileSetPos($File,12,0)
 $Base = _BinaryToInt32(FileRead($File,4))
FileSetPos($File,$Base,0)

Dim $Text
For $i = 1 to $Files
    $Offset = _BinaryToInt32(FileRead($File,4)) + $Base
    $pos = FileGetPos($File)
    FileSetPos($File,$Offset,0)
    $S = ""
    $Str = ""
    Do
        $Str &= $S
        $S = FileRead ($File, 1)
     Until $S = 0
       $Str = BinaryToString("0x" & StringRegExpReplace($Str,"0x",""),4)
       $Str = StringRegExpReplace($Str,@CRLF,"<cf>")
       $Str = StringRegExpReplace($Str,@LF,"<lf>")
       $Str = StringRegExpReplace($Str,@CR,"<cr>")
       $Text &= $Str & @CRLF
    FileSetPos($File,$pos,0)
Next
$hAllTextFil = FileOpen ($Name&".txt", 2+32)
FileWrite ($hAllTextFil, $Text)
FileClose ($hAllTextFil)
TrayTip ("Exporter", "Finish!", 3)
sleep (3000)
Func CompGetFileName($Path)
If StringLen($Path) < 4 Then Return -1
$ret = StringSplit($Path,"\",2)
If IsArray($ret) Then
Return $ret[UBound($ret)-1]
EndIf
If @error Then Return -1
EndFunc
Func _BinaryToInt32($Binary)
    Return BitAND(Int(Binary($Binary)), 0xFFFFFFFF)
EndFunc

 

Edited by carl1905

Share this post


Link to post
Share on other sites

Ah, ha! I got it!!! Thanks a lot! :)

Share this post


Link to post
Share on other sites

Oops, sorry I missed the notification for your previous post. Yet you're lucky: I never answer question related to games (see forum rules why), but I considered your script isn't actually "interacting with one".

Glad to see you finally got it working. It's now up to you to decide which codepage constant has to be used with each file.

1 person likes this

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

3 hours ago, jchd said:

Oops, sorry I missed the notification for your previous post. Yet you're lucky: I never answer question related to games (see forum rules why), but I considered your script isn't actually "interacting with one".

Glad to see you finally got it working. It's now up to you to decide which codepage constant has to be used with each file.

It's fine. Thank you.

 

Edited by carl1905

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Your  Sample file  not is Binary file, You can read file as text and show it.
 

Please create new topic!

29 minutes ago, carl1905 said:

It's fine. Thank you. However, can I ask one more question? For example, uhm.. there is a sample.txt file.

What I want to convert

And I want to change the text to another form using some kind of table.txt How can I transform it?

 

Edited by VIP

“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post


Link to post
Share on other sites
7 minutes ago, VIP said:

Your  Sample file  not is Binary file, You can read file as text and show it.
 

Please create new topic!

Oh, yes. I created new topic.

Share this post


Link to post
Share on other sites

@VIP,

Why do you believe the sample isn't binary? It is. Period.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
3 minutes ago, jchd said:

@VIP,

Why do you believe the sample isn't binary? It is. Period.

Think Simple (: All files are stored as binary.
what I mean is that it's just open file with EUC-JP encoding to see text!


“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post


Link to post
Share on other sites

That's utterly unreliable! Look at the file with a hex editor and you see why.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Good Lucky:

#EndRegion Author C490C3A06F2056C4836E2054726F6E67
; Export Language PS XL

Local $sFilePath = FileOpenDialog("Select the dat file", @ScriptDir, "dat files (*.dat)", 1)
If @error = 1 Then Exit

XLangPSExport($sFilePath)
If Not @error Then
    TrayTip("Exporter", "Finish!", 3)
Else
    Exit MsgBox(0, "Error!", 'Wrong Lang ID: Only for XL')
EndIf

Func XLangPSExport($sFilePath, $sOutFile = Default)
    Local $hFile = FileOpen($sFilePath, 16)
    If FileRead($hFile, 2) <> "XL" Then Return SetError(1, 0, 0)
    FileSetPos($hFile, 8, 0)
    Local $sLineContent = FileRead($hFile, 2)
    FileSetPos($hFile, 12, 0)
    Local $sOffset = BitAND(Int(Binary(FileRead($hFile, 4))), 0xFFFFFFFF)
    FileSetPos($hFile, $sOffset, 0)
    If $sOutFile = Default Then $sOutFile = $sFilePath & ".lang"
    Local $sNewText, $sPos, $tmpHex, $Offset, $tmpStr
    For $i = 1 To $sLineContent
        $Offset = BitAND(Int(Binary(FileRead($hFile, 4))), 0xFFFFFFFF) + $sOffset
        $sPos = FileGetPos($hFile)
        FileSetPos($hFile, $Offset, 0)
        While 1
            $tmpHex = FileRead($hFile, 1)
            If @error Or $tmpHex = 0 Then ExitLoop
            $tmpStr &= $tmpHex
        WEnd
        FileSetPos($hFile, $sPos, 0)
        $tmpStr = StringReplace($tmpStr, StringToBinary(@CRLF), StringToBinary("<CF>"));~ 0x0D0A
        $tmpStr = StringReplace($tmpStr, StringToBinary(@LF), StringToBinary("<LF>"));~ 0x0A
        $tmpStr = StringReplace($tmpStr, StringToBinary(@CR), StringToBinary("<CR>"));~ 0x0D
        $sNewText &= $tmpStr & "0D0A";@CRLF
        $tmpStr = ""
    Next
    While StringInStr($sNewText, "0D0A0D0A")
        $sNewText = StringReplace($sNewText, "0D0A0D0A", "0D0A")
    WEnd
    $sNewText = "0x" & StringReplace($sNewText, "0x", "")
    FileClose($hFile)
    $hFile = FileOpen($sOutFile, 2 + 8 + 16)
    FileWrite($hFile, Binary($sNewText))
    FileClose($hFile)
EndFunc   ;==>XLangPSExport

 

If your problem has been resolved, please modify Topic Title add  [Solved]
Click LIKE THIS to thanks!


“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post


Link to post
Share on other sites
56 minutes ago, VIP said:

Good Lucky:

#EndRegion Author C490C3A06F2056C4836E2054726F6E67
; Export Language PS XL

Local $sFilePath = FileOpenDialog("Select the dat file", @ScriptDir, "dat files (*.dat)", 1)
If @error = 1 Then Exit

XLangPSExport($sFilePath)
If Not @error Then
    TrayTip("Exporter", "Finish!", 3)
Else
    Exit MsgBox(0, "Error!", 'Wrong Lang ID: Only for XL')
EndIf

Func XLangPSExport($sFilePath, $sOutFile = Default)
    Local $hFile = FileOpen($sFilePath, 16)
    If FileRead($hFile, 2) <> "XL" Then Return SetError(1, 0, 0)
    FileSetPos($hFile, 8, 0)
    Local $sLineContent = FileRead($hFile, 2)
    FileSetPos($hFile, 12, 0)
    Local $sOffset = BitAND(Int(Binary(FileRead($hFile, 4))), 0xFFFFFFFF)
    FileSetPos($hFile, $sOffset, 0)
    If $sOutFile = Default Then $sOutFile = $sFilePath & ".lang"
    Local $sNewText, $sPos, $tmpHex, $Offset, $tmpStr
    For $i = 1 To $sLineContent
        $Offset = BitAND(Int(Binary(FileRead($hFile, 4))), 0xFFFFFFFF) + $sOffset
        $sPos = FileGetPos($hFile)
        FileSetPos($hFile, $Offset, 0)
        While 1
            $tmpHex = FileRead($hFile, 1)
            If @error Or $tmpHex = 0 Then ExitLoop
            $tmpStr &= $tmpHex
        WEnd
        FileSetPos($hFile, $sPos, 0)
        $tmpStr = StringReplace($tmpStr, StringToBinary(@CRLF), StringToBinary("<CF>"));~ 0x0D0A
        $tmpStr = StringReplace($tmpStr, StringToBinary(@LF), StringToBinary("<LF>"));~ 0x0A
        $tmpStr = StringReplace($tmpStr, StringToBinary(@CR), StringToBinary("<CR>"));~ 0x0D
        $sNewText &= $tmpStr & "0D0A";@CRLF
        $tmpStr = ""
    Next
    While StringInStr($sNewText, "0D0A0D0A")
        $sNewText = StringReplace($sNewText, "0D0A0D0A", "0D0A")
    WEnd
    $sNewText = "0x" & StringReplace($sNewText, "0x", "")
    FileClose($hFile)
    $hFile = FileOpen($sOutFile, 2 + 8 + 16)
    FileWrite($hFile, Binary($sNewText))
    FileClose($hFile)
EndFunc   ;==>XLangPSExport

 

If your problem has been resolved, please modify Topic Title add  [Solved]
Click LIKE THIS to thanks!

Thanks you. Your coed can extract text and save it as Shift-JIS from binary file.

My codes(add function from jchd) will extract Japanese text and save it as UTF-16LE.

#include <FileConstants.au3>
Global Const $CP_SHIFT_JIS = 932

$Path = FileOpenDialog("Select the dat file", @ScriptDir, "dat files (*.dat)",1)
If @error = 1 Then Exit
$File = fileopen($Path,16)
$Name = CompGetFileName($Path)
$Id = FileRead($File,2)
If $Id <> "XL" Then
    MsgBox(0,"Error!",'Wrong id: "'&BinaryToString($Id)&'"'&@CR&'Expected: "XL"')
    Exit
 EndIf
 FileSetPos($File,8,0)
 $Files = FileRead($File,2)
 FileSetPos($File,12,0)
 $Base = _BinaryToInt32(FileRead($File,4))
FileSetPos($File,$Base,0)

Dim $Text
For $i = 1 to $Files
    $Offset = _BinaryToInt32(FileRead($File,4)) + $Base
    $pos = FileGetPos($File)
    FileSetPos($File,$Offset,0)
    $S = ""
    $Str = ""
    Do
        $Str &= $S
        $S = FileRead ($File, 1)
     Until $S = 0
       $Inp = Binary("0x" & StringRegExpReplace($Str,"0x",""))

       Local $tInp = DllStructCreate("byte[" & BinaryLen($Inp) & "]")
       DllStructSetData($tInp, 1, $Inp)

       Local $Str = _CodepageStructToString($tInp, $CP_SHIFT_JIS)
       $Str = StringRegExpReplace($Str,@CRLF,"<cf>")
       $Str = StringRegExpReplace($Str,@LF,"<lf>")
       $Str = StringRegExpReplace($Str,@CR,"<cr>")
       $Text &= $Str & @CRLF
    FileSetPos($File,$pos,0)
Next
$hAllTextFil = FileOpen ($Name&".txt", 2+32)
FileWrite ($hAllTextFil, $Text)
FileClose ($hAllTextFil)
TrayTip ("Exporter", "Finish!", 3)
sleep (3000)
Func CompGetFileName($Path)
If StringLen($Path) < 4 Then Return -1
$ret = StringSplit($Path,"\",2)
If IsArray($ret) Then
Return $ret[UBound($ret)-1]
EndIf
If @error Then Return -1
EndFunc
Func _BinaryToInt32($Binary)
    Return BitAND(Int(Binary($Binary)), 0xFFFFFFFF)
 EndFunc
 Func _CodepageStructToString($tText, $iCodepage)
    Local $aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", DllStructGetSize($tText), _
                                "ptr", 0, "int", 0)
    Local $tWstr = DllStructCreate("wchar[" & $aResult[0] & "]")
    $aResult = DllCall("Kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", DllStructGetSize($tText), _
                        "struct*", $tWstr, "int", $aResult[0])
    Return DllStructGetData($tWstr, 1)
EndFunc

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

it saved as as binary, not convert encoding.

Edited by VIP

“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

6 minutes ago, VIP said:

it saved as a binary, not convert encoding.

Uhm.. After I translate text into another language, I will put it back to binary.

Edited by carl1905

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

You can use it to convert:

Function:

#include <WinAPI.au3>

;~ _ConvertEncodingFile(@DesktopDir & "\sample.txt", @DesktopDir & "\NEW_sample.txt", 932) ;iCodepage: SHIFT_JIS = 932

Func _ConvertEncodingFile($sFilePathIN, $sFilePathOUT = Default, $iCodePage = 65001) ;iCodepage: UTF-8=65001
    ; iCodepage: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx
    If Not FileExists($sFilePathIN) Then Return SetError(1, 0, 0)
    Local $hOpen = FileOpen($sFilePathIN, 16384)
    If $sFilePathOUT = Default Then $sFilePathOUT = $sFilePathIN
    Local $sContent = FileRead($hOpen)
    If @error Or StringStripWS($sContent, 8) = "" Then Return SetError(2, 0, 0)
    FileClose($hOpen)
    $sContent = _WinAPI_WideCharToMultiByte($sContent, $iCodePage, 1)
    If @error Then Return SetError(3, @error, 0)
    $hOpen = FileOpen($sFilePathOUT, 2 + 8 + 16)
    FileWrite($hOpen, $sContent)
    If @error Then Return SetError(4, @error, 0)
    FileClose($hOpen)
    Return 1
EndFunc   ;==>_ConvertEncodingFile

 

Edited by Trong
Function Convert

“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

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

  • Similar Content

    • xiantez
      By xiantez
      Hello AutoIT community. 
      I am attempting to make a script that will login to my bank account and retrieve one of my account balances and display it in a MsgBox, however it am having some difficulty getting the correct value.... The MsgBox keep displaying a value of "0" instead of the actual string in between the source code I'm looking for.... Any help would be greatly appreciated!
      $readtext = InetRead("https://www.xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&amp;LOB=CONS",1)
      $source = BinaryToString($readtext)
      $text =  _StringBetween($source,'CHECKING XXXXXXXXXX&nbsp;', ' "> ')

      MsgBox(0,"balance",$text)     ;This keeps returning a value of "0"

              Case $GUI_EVENT_CLOSE
                 GUIDelete($Form1)
                  ExitLoop
               Case $Button2
                  GUIDelete($Form1)
                  ExitLoop
          EndSwitch
      WEnd
       
       
    • gooker
      By gooker
      Hi :
      My os is ubuntu 14.04 ,wine version is 1.7.
      The problem is as follows:
      When I use BinaryToString example , in the help file (https://www.autoitscript.com/autoit3/docs/functions/BinaryToString.htm), running under the win7 is ok.
      When I was running in wine, "你好"  change to  "??".

      The binary code(0x4865...) is correct, the result is wrong, I think the problem is the BinaryToString function itself.
      Whether there is a solution,
      If someone can help me ,thank you!
       
    • Tardis
      By Tardis
      Hi all Im still New To Autoit and would realy like some help ...

      I have gone through some examples and other code on the forum but now I am stuck
      see comments on what I want to do .
      #RequireAdmin #include <IE.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <String.au3> #include <Array.au3> Global $oIE = _IECreate("https://www.harryhomers.org/et/forum/viewtopic.php?f=89&t=4309", 0, 0, 1, 0) Global $oElements = _IETagNameAllGetCollection($oIE) Global $oID = _IEGetObjById($oIE, "p41827") Global $ListArray[1] #cs ; the list I want to get is 1 - 20 max 30 and there names . The DIV ID is p41827 <div class="content">HarryHomers can be found at 85.236.100.205:<span style="font-weight: bold">27960</span><br /><br /><ul>HH Bot Multi campaign **<br /><br />1. NAME 1<br />2. NAME 2<br />3. NAME 3<br />4. NAME 4<br /> 5. NAME 5<br />6. NAME 6<br />7. NAME 7<br />8. NAME 8<br />9. NAME 9<br />10. NAME 10<br />11. NAME 11<br />12. NAME 12<br />13. NAME 13<br />14. NAME 14<br /> 15. NAME 15<br />16. NAME 16<br />17. NAME 17<br />18. NAME 18<br />19. NAME 19<br />20. NAME 20<br /> </ul> #ce For $oElement in $oElements     Local $_sSourceTAG = $oElement.tagname     Local $_sSourceTEXT = $oElement.innerText     Local $_sSourceID = $oElement.id     Local $_sSourceHTML = $oElement.innerhtml     If $_sSourceID = "p41827" Then ;Test message box                 MsgBox($MB_SYSTEMMODAL, "MY TAG ID", "Innertext: "  & $_sSourceTAG & @CRLF & "id: " & $_sSourceID & @CRLF & "innerText: " & $_sSourceTEXT)                 MsgBox($MB_SYSTEMMODAL, "MY HTML", "Innerhtml: "  & "id: " & $_sSourceID & $_sSourceHTML)         $oData = _IEPropertyGet($oIE, "strong")         $Check = StringRight($oData, 11)         If $Check = "ohnDory</A>" Then ;Test message box             MsgBox($MB_SYSTEMMODAL, "SEARCH FOUND", "The characters are: " & $Check )             $ArraySplit1 = StringSplit($oData, ".")             For $ArrayItem in $ArraySplit1                 $ArrayItem = StringSplit($ArrayItem, "<BR>", 1)                 If $ArrayItem[0] > 1 Then                     If $ArrayItem[2] > 0 Then                         $ArrayItem[1] = StringStripWS($ArrayItem[1], 3)                         _ArrayAdd($ListArray, $ArrayItem[1])                     EndIf                 EndIf                 If StringInStr($ArrayItem[1], "</UL>") Then                     $POS = StringInStr($ArrayItem[1], "</UL>") - 1                     $String = StringLeft($ArrayItem[1], $POS)                     $String = StringStripWS($String, 3)                     _ArrayAdd($ListArray, $String)                 EndIf             Next         Else ; Not correct so ignore         MsgBox($MB_SYSTEMMODAL, "NOT FOUND", "The characters are: " & $Check )         EndIf     EndIf     Next     _ArrayDisplay($ListArray)     _ArrayReverse($ListArray)     _ArrayPop($ListArray)     _ArrayReverse($ListArray)     _ArrayDisplay($ListArray, "Map List Array Final View")     sleep(2500) _IEQuit($oIE) #cs ; note the html (map names) does change once a month ; save txt file #ce ;_FileWriteLog(@TempDir & "\list.txt", $ListArray)