WARLICHVN Posted July 21, 2009 Share 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 Link to comment Share on other sites More sharing options...
water Posted July 21, 2009 Share 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
WARLICHVN Posted July 21, 2009 Author Share Posted July 21, 2009 Thank you water! Link to comment Share on other sites More sharing options...
WARLICHVN Posted July 21, 2009 Author Share 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 Link to comment Share on other sites More sharing options...
99ojo Posted July 21, 2009 Share 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 Link to comment Share on other sites More sharing options...
WARLICHVN Posted July 21, 2009 Author Share Posted July 21, 2009 Thank you so much 99ojo!!! Link to comment Share on other sites More sharing options...
WARLICHVN Posted July 22, 2009 Author Share Posted July 22, 2009 (edited) How to do it in Func ? Edited July 22, 2009 by WARLICHVN Link to comment Share on other sites More sharing options...
99ojo Posted July 23, 2009 Share 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 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