AutoDEV Posted March 1 Share Posted March 1 Hello, I have this codde : Func _News() Local $dData = InetRead('https://www.websit.com/news.txt') If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF) Local $sData = BinaryToString($dData) Local $iDelete = FileDelete(@ScriptDir & '\news.txt') Local $hFile = FileOpen(@ScriptDir & '\news.txt',3 ) FileWrite($hFile, $sData) FileClose($hFile) Local $aArray = IniReadSection(@ScriptDir & '\news.txt', 'NEWS') If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF) For $i = 0 To UBound($aArray) - 1 $previousJournalNews = GUICtrlRead($journalNews) If $aArray[$i][1] <> "" Then GUICtrlSetData($journalNews, $aArray[$i][1] & @CRLF, 0) EndIf Next EndFunc But when i show in my soft i show this : Why please, i have up my ISN autoit to latest version and autoit too. THX Link to comment Share on other sites More sharing options...
ioa747 Posted March 1 Share Posted March 1 Local $hFile = FileOpen(@ScriptDir & '\news.txt', 3) ;~ here 3 means : $FO_APPEND(1) + $FO_OVERWRITE(2) ;~ you have To add plus $FO_UTF8_NOBOM(256) so 1 + 2 + 256 = 259 Local $hFile = FileOpen(@ScriptDir & '\news.txt', 259) SOLVE-SMART 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Andreik Posted March 1 Share Posted March 1 BinaryToString() also have a flag parameter that allows you to convert your data. Check the help file. SOLVE-SMART 1 Link to comment Share on other sites More sharing options...
AutoDEV Posted March 3 Author Share Posted March 3 OK I have this now : Local $dData = InetRead('https://www.site.com/testUTF8.txt', 1) If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF) Local $sData = BinaryToString($dData, 4) Local $iDelete = FileDelete(@ScriptDir & '\news.txt') Local $hFile = FileOpen(@ScriptDir & '\news.txt', 259) FileWrite($hFile, $sData) FileClose($hFile) Local $aArray = IniReadSection(@ScriptDir & '\news.txt', 'NEWS') If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF) For $i = 0 To UBound($aArray) - 1 $previousJournalNews = GUICtrlRead($journalNews) If $aArray[$i][1] <> "" Then GUICtrlSetData($journalNews, $aArray[$i][1] & @CRLF, 0) EndIf Next My file is good if i show on internet exploerer. And file download is good. But now any news appear in my soft. $Group4 = GUICtrlCreateGroup("News", 288, 304, 241, 185) $journalNews = GUICtrlCreateEdit("", 296, 328, 225, 153, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) My txt file content : [NEWS] 1=test é Link to comment Share on other sites More sharing options...
Andreik Posted March 3 Share Posted March 3 #include <GUIConstantsEx.au3> #include <EditConstants.au3> $hGUI = GUICreate('Example', 800, 600) $Group4 = GUICtrlCreateGroup("News", 288, 304, 241, 185) $journalNews = GUICtrlCreateEdit("", 296, 328, 225, 153, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) GUISetState(@SW_SHOW, $hGUI) Local $aArray = IniReadSection(@ScriptDir & '\news.txt', 'NEWS') If IsArray($aArray) Then GUICtrlSetData($journalNews, BinaryToString(StringToBinary($aArray[1][1]), 4)) EndIf Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
AutoDEV Posted March 4 Author Share Posted March 4 Andreik Your are one god ! Work perfectly. 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