Jump to content
Sign in to follow this  
lobstersim

How to open HTML file as Text File?

Recommended Posts

lobstersim

need help

how to open HTML file as text file?

open for editing its source.

I don't see the file pop up when using FileOpen()

thanks in advanced

$message = "Select the HTML file you want to edit"
$filePath = FileOpenDialog($message, "", "HTML Files(*.htm;*.html)")

If @error Then
    Exit
Else
    $file = FileOpen($filePath, 1)
EndIf

Share this post


Link to post
Share on other sites
seandisanti

need help

how to open HTML file as text file?

open for editing its source.

I don't see the file pop up when using FileOpen()

thanks in advanced

$message = "Select the HTML file you want to edit"
$filePath = FileOpenDialog($message, "", "HTML Files(*.htm;*.html)")

If @error Then
    Exit
Else
    $file = FileOpen($filePath, 1)
EndIf
Run("notepad.exe mypage.html")

Share this post


Link to post
Share on other sites
flyingboz

need help

how to open HTML file as text file?

open for editing its source.

I don't see the file pop up when using FileOpen()

you won't see a popup using fileopen() - you need to open the file for reading first, put the contents

in a variable, close the filehandle, make your edits, then write the file back out..

ie

;get filehandle for reading in file
$fh = FileOpen($filename,0)
;get contents of file
$contents = FileRead($fh,FileGetSize($filename))

fileclose($fh)
;do stuff to $contents
;write out new file

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites
lobstersim

thanks flyingboz & cameronsdad for your replies.

really appreciate it ;)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×