WARLICHVN Posted July 21, 2009 Posted July 21, 2009 (edited) First, I would like to sincerely thank everyone for the help yesterday (subject: the string and array). Items of today I people need help is: I get to keep material from 1 File: Name.txt In file Name.txt many lines are divided by characters "|" (eg : 500 Lines) Duties of the program after 1 time period (eg 3 minutes) will read to line 2, line 3 ... n line. That is after 1 time period the number read will be + 1 Wishes to receive the help of everyone! Edited July 21, 2009 by WARLICHVN
water Posted July 21, 2009 Posted July 21, 2009 (edited) $hFile = FileOpen("Your File",0) While 1 $line = FileReadLine($hFile) Sleep(18000) Wend FileClose($hFile) Edited July 21, 2009 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
WARLICHVN Posted July 21, 2009 Author Posted July 21, 2009 (edited) Oh sorry, but have some problem when problem read line eg . File : Name.txt Name1|Addr1|PhoneNumber1 Name2|Addr2|PhoneNumber2 MyCode: $hFile = FileOpen("Name.txt",0) While 1 $line = FileReadLine($hFile) If @error = -1 Then ExitLoop MsgBox(0,"A",$line) Sleep(2000) FileClose($hFile) Wend So it's not read line 2 Edited July 21, 2009 by WARLICHVN
99ojo Posted July 21, 2009 Posted July 21, 2009 (edited) Oh sorry, but have some problem when problem read line eg . File : Name.txt Name1|Addr1|PhoneNumber1 Name2|Addr2|PhoneNumber2 MyCode: $hFile = FileOpen("Name.txt",0) While 1 $line = FileReadLine($hFile) If @error = -1 Then ExitLoop MsgBox(0,"A",$line) Sleep(2000) FileClose($hFile) Wend So it's not read line 2 Hi, set the FileClose ($hFile) after the Wend or use a counter e.g. $hFile = FileOpen("Name.txt",0) While 1 $line = FileReadLine($hFile) If @error = -1 Then ExitLoop MsgBox(0,"A",$line) Sleep(2000) Wend FileClose($hFile) or $i = 1 While 1 $hFile = FileOpen("Name.txt",0) $line = FileReadLine($hFile, $i) If @error = -1 Then ExitLoop MsgBox(0,"A",$line) $i += 1 Sleep(2000) FileClose($hFile) Wend Edited July 21, 2009 by 99ojo
WARLICHVN Posted July 22, 2009 Author Posted July 22, 2009 (edited) How to do it in Func ? Edited July 22, 2009 by WARLICHVN
99ojo Posted July 23, 2009 Posted July 23, 2009 (edited) How to do it in Func ? Hi, two ways: 1st) Global $file = "name.txt" _ReadFile () Func _ReadFile () $hFile = FileOpen($file, 0) While 1 $line = FileReadLine($hFile) If @error = -1 Then ExitLoop MsgBox(0,"A",$line) Sleep(2000) Wend FileClose($hFile) EndFunc or _ReadFile ("name.txt") Func _ReadFile ($file) $hFile = FileOpen($file, 0) While 1 $line = FileReadLine($hFile) If @error = -1 Then ExitLoop MsgBox(0,"A",$line) Sleep(2000) Wend FileClose($hFile) EndFunc ;-)) Stefan Edited July 23, 2009 by 99ojo
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