Frozenyam Posted August 12, 2005 Posted August 12, 2005 (edited) #Include-Once Func _CountLines (ByRef $File) Global $Count = 0 FileOpen ($File, 0) Do $Count = $Count + 1 $CountLine = FileReadLine ($File, $Count) Until @Error = -1 Return $Count - 1 EndFunc Will count the lines in a file without problems and will output it to a variable. Use Of Function: #Include <_CountLines.au3> $File = "Path\Name.Extention" $NumOfLines = _CountLines ($File)_CountLines.au3 Edited August 12, 2005 by Frozenyam "... and the Lord said to John, "Come forth and ye shall receive eternal life," but instead John came fifth and won a toaster."
w0uter Posted August 12, 2005 Posted August 12, 2005 (edited) make the variabels LOCAL. you didnt open the file. you also didnt close the file. and why a byref ? Edited August 12, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Josbe Posted August 12, 2005 Posted August 12, 2005 #Include-Once Func _CountLines (ByRef $File) Global $Count = 0 FileOpen ($File, 0) Do $Count = $Count + 1 $CountLine = FileReadLine ($File, $Count) Until @Error = -1 Return $Count - 1 EndFuncWill count the lines in a file without problems and will output it to a variable.Use Of Function:#Include <_CountLines.au3> $File = "Path\Name.Extention" $NumOfLines = _CountLines ($File)<{POST_SNAPBACK}>Nice try, but too late. This function was improved by Tylo, and included in the standard UDF. >> File.au3 <<To improve your code, look the w0uter remarks also. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
Developers Jos Posted August 12, 2005 Developers Posted August 12, 2005 (edited) Frozenyam PMed me with this update and i mentioned the same, but he claimed that the current version is broken. Its better to report the BUG when current UDF's don't work then to come up with a modified version, because this gives the original author of a UDF to fix or update the UDF. Edited August 12, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Josbe Posted August 12, 2005 Posted August 12, 2005 Frozenyam PMed me with this update and i mentioned the same, but he claimed that the current version is broken.Its better to report the BUG when current UDF's don't work then to come up with a modified version, because this give the original writer of a UDF to fix or update the UDF. <{POST_SNAPBACK}> http://www.autoitscript.com/fileman/users/Josbe/_sforum/smilies/yes.gif I agree completely. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
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