Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search in html file

Status
Not open for further replies.

154868

Programmer
Dec 5, 2003
23
0
0
I want to analyse html-files.

1) i open my html with shellexecute (no problem)
2) I want to search strings automatically in this html
3) I want to close my html, if search is done

How can I do this ?

Thanks for any help
Andreas

Andreas Wichmann
DataBit GmbH
Switzerland
 
Hi Andreas,

HTLM files are text files. You can open them using the following code:

Code:
lcHTMLFile = GETFILE('HTML','OPEN HTML','HTML')
lcHTMLCode = FILETOSTR(lcHTMLFile)

lcNewHTMLCode = lcHtmlCode

*-- Do whatever analysis needed
lcNewHTML = STRTRAN(lcNewHTMLCOde, "My old string", "My new string")


*-- Other analysis as needed

*-- Save if code has changed
IF lcNewHTMLCode #  lcHtmlCode
   STRTOFILE(lcNewHTMLCode, lcHtmlFile)
ENDIF

Jean
 

Andreas,

You can't automate the search if you open the files with ShellExecute(). You would have to use Automation, or create a web browser control using COM.

Jean's solution is much easier -- just treat the files as text files.

Do you need to do this task programmatically, or is it something you can do interactively? If the latter, the Code References tool can be used to do search-and-replace in HTML files. Just set the file type to Text.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hi Jean,

Thanks a lot, that's what I'm looking for.

Andreas

Andreas Wichmann
DataBit GmbH
Switzerland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top