Xander Posted February 1, 2019 Posted February 1, 2019 I want to parse an HTML file for keywords. I've currently got it working adequately but, in the file, there's never anything in the first 150 lines. $length = _FileCountLines($file) ProgressOn("Cataloging Software","Collecting previously installed titles","") ; Read in lines of text until the EOF is reached For $i = 1 to $length If $i > $length then ExitLoop ;just in case If @error = -1 Then ExitLoop ;just in case $prog=$param If Stringlen($param)>40 then $prog=StringLeft($param,40) & @crlf & StringMid($param,40) ;blahblahblah many snipped, irrelevant lines here Next $i Not that it takes that long to parse 150 lines but it seemed like something worth asking and learning from. So -- anyway to start the parsing at line 150?
BrewManNH Posted February 1, 2019 Posted February 1, 2019 19 minutes ago, Xander said: o -- anyway to start the parsing at line 150? Your code makes no sense as written, how about helping us help you by including where you're getting the $param defined, what you're using the loop for (because you're not using the $i variable anywhere in it in the code), and any other pertinent code that would show us what it is you're trying to accomplish. FrancescoDiMuro 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
BigDaddyO Posted February 4, 2019 Posted February 4, 2019 You should look into FileReadToArray() or if you want to split it up further, _FileReadToArray(). Then you just start your loop at 150 $aHTMLfile = FileReadToArray($sPathToFile) if @error then Exit $iCount = @extended if $iCount < 150 then Exit ;Should be > 150 lines For $i = 150 to $iCount if StringLen($aHTMLfile[$i]) > 40 then ... Next
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