Thebarbarius Posted January 18, 2022 Share Posted January 18, 2022 Hello i have this : Local $dData = InetRead("https://www.mysitehelp.com/news.txt") Local $aArray = IniReadSection($dData, "NEWS") MsgBox(0, "test", $aArray) Can you help with external file ? My return value for MsgBox is 1 and not array. Help me please THX Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 18, 2022 Moderators Share Posted January 18, 2022 Thebarbarius, Is the data you read in the correct ini format? If not, then IniRead will fail. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Thebarbarius Posted January 18, 2022 Author Share Posted January 18, 2022 Hello. My my file have this : [NEWS] 1=hello all 2=goodbye I don't have problem with local file. Link to comment Share on other sites More sharing options...
Musashi Posted January 18, 2022 Share Posted January 18, 2022 (edited) 3 minutes ago, Thebarbarius said: I don't have problem with local file. Hmm, I'm getting an Error from InetRead : Local $dData = InetRead("https://www.mysitehelp.com/news.txt") Local $iError = @error Local $iBytesRead = @extended ConsoleWrite("Error = " & $iError & @CRLF & _ "BytesRead = " & $iBytesRead & @CRLF ) Local $sData = BinaryToString($dData) ConsoleWrite($sData & @CRLF) Edited January 18, 2022 by Musashi typo "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Thebarbarius Posted January 18, 2022 Author Share Posted January 18, 2022 OK. THX Quote Local $aArray = IniReadSection($dData, "NEWS") NO return a array but 1 Link to comment Share on other sites More sharing options...
Luke94 Posted January 18, 2022 Share Posted January 18, 2022 Think he's replaced the original URL because the website isn't accessible for me. #include <Array.au3> Local $dData = InetRead('https://www.mysitehelp.com/news.txt') If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF) Local $sData = BinaryToString($dData) Local $aArray = IniReadSection($sData, 'NEWS') If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF) _ArrayDisplay($aArray) What output do you get from the above @Thebarbarius? Link to comment Share on other sites More sharing options...
Thebarbarius Posted January 18, 2022 Author Share Posted January 18, 2022 I have this Quote Error: IniReadSection - 1 Link to comment Share on other sites More sharing options...
Luke94 Posted January 18, 2022 Share Posted January 18, 2022 (edited) I think IniReadSection only accepts a File Name, not text. Quote IniReadSection ( "filename", "section" ) Maybe try writing the text to an INI file first? #include <Array.au3> #include <File.au3> Local $dData = InetRead('https://www.mysitehelp.com/news.txt') If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF) Local $sData = BinaryToString($dData) Local $hFile = FileOpen(@ScriptDir & '\Output.ini', 2) FileWrite($hFile, $sData) FileClose($hFile) Local $aArray = IniReadSection(@ScriptDir & '\Output.ini', 'NEWS') If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF) _ArrayDisplay($aArray) Edited January 18, 2022 by Luke94 Link to comment Share on other sites More sharing options...
Musashi Posted January 18, 2022 Share Posted January 18, 2022 5 minutes ago, Luke94 said: What output do you get from the above Error: InetRead - 13 Error: IniReadSection - 1 The error arises, as in my example, already at InetRead. -1 at IniReadSection is a subsequent error. @Thebarbarius : Please run the script from @Luke94 and post the output from the SciTE console. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Thebarbarius Posted January 18, 2022 Author Share Posted January 18, 2022 Now i have this. I have one gui with news and i need know how ti add news in GUI Link to comment Share on other sites More sharing options...
Luke94 Posted January 18, 2022 Share Posted January 18, 2022 That depends on your GUI? You could add the array to a ListView with _GUICtrlListView_AddArray. Link to comment Share on other sites More sharing options...
Thebarbarius Posted January 18, 2022 Author Share Posted January 18, 2022 I have make this : Local $dData = InetRead('https://www.mywebsite.com/news.txt') If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF) Local $sData = BinaryToString($dData) Local $hFile = FileOpen(@ScriptDir & '\Output.ini', 2) FileWrite($hFile, $sData) FileClose($hFile) Local $aArray = IniReadSection(@ScriptDir & '\Output.ini', 'NEWS') If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF) For $i = 1 To $aArray[0][0] $previousJournalNews = GUICtrlRead($journalNews) GUICtrlSetData($journalNews, $aArray[$i][1] & @CRLF) Next And i have this result : Why i don't have all news in my GUI ? Quote [NEWS] 1=Welcomme 2=BLAVLA Link to comment Share on other sites More sharing options...
TheSaint Posted January 18, 2022 Share Posted January 18, 2022 1 hour ago, Thebarbarius said: Hello i have this : Local $dData = InetRead("https://www.mysitehelp.com/news.txt") Local $aArray = IniReadSection($dData, "NEWS") MsgBox(0, "test", $aArray) Can you help with external file ? My return value for MsgBox is 1 and not array. Help me please THX The reason you are not getting the return you are probably hoping for, is you are not specifying what part of the $aArray, so it just appears blank or you get an error return value. For instance, if you use the following, you will get the number 2, which is how many entries for NEWS. MsgBox(0, "test", $aArray[0][0]) Also try something like MsgBox(0, "test", $aArray[0][1]) or MsgBox(0, "test", $aArray[1][0]) Then investigate the Help file to get an explanation for the IniReadSection command. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Thebarbarius Posted January 18, 2022 Author Share Posted January 18, 2022 Func _Example2() Local $dData = InetRead('https://www.mywebsite.com/news.txt') If @error Then ConsoleWrite('Error: InetRead - ' & @error & @CRLF) Local $sData = BinaryToString($dData) Local $hFile = FileOpen(@ScriptDir & '\Output.ini', 2) FileWrite($hFile, $sData) FileClose($hFile) Local $aArray = IniReadSection(@ScriptDir & '\Output.ini', 'NEWS') If @error Then ConsoleWrite('Error: IniReadSection - ' & @error & @CRLF) For $i = 0 To $aArray[0][0] $previousJournalNews = GUICtrlRead($journalNews) GUICtrlSetData($journalNews, $aArray[$i][1] & @CRLF) Next EndFunc With this i don't know how to add all news in GUI If u can help it's important Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 18, 2022 Moderators Share Posted January 18, 2022 (edited) Thebarbarius, or should I call you YuChan? Why have you opened a new account after having been banned previously? M23 P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out. Edited January 18, 2022 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 19, 2022 Moderators Share Posted January 19, 2022 All, Read the PS above. The next one who posts before I clear the thread gets a holiday. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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