EarthlingZ Posted November 2, 2020 Share Posted November 2, 2020 Hi I want fetch everything behind , and , in the text file. I have tried to find what I am doing wrong but I cant see it. Can I get help with two extra eyes who can see what I have done wrong? My script looks like this #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <String.au3> $FilePath = 'Testing9.txt' $Source = BinaryToString(IniReadSection($FilePath, "")) $FirstChunks = _StringBetween($Source, ',', ',') For $a In $FirstChunks ConsoleWrite($a & @CRLF) Sleep(1000) Next Inside Testing9.txt dfsgasdfadsfads, Test1! ,dsafsdagasfgf asdgasdfasd, Test2! ,sadfasdgasdfg74698 asdfasdfasd, Test3! ,dsagfgerargar reggasdgadfsdg, Test4! ,gewgregegsreg rgsfgdfsgff, Test5! ,regegfrdgfdsg6546 dfsbsdbfvsf, Test6! ,4563489465464 hetgbsdffsd, Test7! ,regbrregszgsf sfgdf84gds65, Test8! ,fsdg8df4g6s5df4 rgewarg6456, Test9! ,fsg564654fsg error I get is "C:\autoit\Script\Testing9.au3" (11) : ==> Variable must be of type "Object".: For $a In $FirstChunks For $a In $FirstChunks^ ERROR Link to comment Share on other sites More sharing options...
Nine Posted November 2, 2020 Share Posted November 2, 2020 (edited) I know the message is misleading, but it also says (in other words) that your variable is not an 1D array. Try this instead : #include <Constants.au3> #include <Array.au3> $FilePath = 'Testing9.txt' $Source = FileRead($FilePath) Local $FirstChunks[0][3] _ArrayAdd($FirstChunks, $Source, 0, ",", @CRLF) For $i = 0 to UBound($FirstChunks, 1) - 1 For $j = 0 to UBound($FirstChunks, 2) - 1 ConsoleWrite($FirstChunks[$i][$j] & @CRLF) Next Next Edited November 2, 2020 by Nine EarthlingZ 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
EarthlingZ Posted November 2, 2020 Author Share Posted November 2, 2020 Thank you so very much for the help and explain what the error message mean. 😃 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