Jump to content

Open local html page


Recommended Posts

The script should open the web page and allow your browser to read?

ShellExecute(@ScriptDir & "\page.html") ; Your page

http://www.autoitscript.com/autoit3/docs/functions/ShellExecute.htm

It should "capture" the text into a variable of the HTML page?

$File = FileOpen(@ScriptDir & "\page.html", 0)

If $File = -1 Then
    Exit
EndIf

While 1
    $FileRead = FileRead($File, 1)
    If @error = -1 Then ExitLoop
    MsgBox(0, "HTML page", $FileRead)
Wend

FileClose($File)

http://www.autoitscript.com/autoit3/docs/functions/FileRead.htm

You want to take a specific part of the HTML page? As with all content in Javascript, for example?

(?i)(?s).*<script type='text/javascript'>(.*)</script>

http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm

http://www.autoitscript.com/autoit3/docs/functions/StringRegExpReplace.htm

It needs a native code?

Link to comment
Share on other sites

ShellExecute("iexplore.exe page.html")

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm
Link to comment
Share on other sites

Thanks for the quick reply's, got it working now :)

I used

ShellExecute(@ScriptDir & "\page.html") ; Your page

You made a really easy question. I think it's normal that you received almost instant response. :)

You're welcome :mellow:

Does this help you?

Note i have given my example location and the html... you use yours :)

#include <IE.au3>
$oIE = _IECreate ("c:\Temp\page.html")

Better ShellExecute()

Your script opens the HTML file with Internet Exploded Explorer. The mine with the default browser.

Link to comment
Share on other sites

@Goodware:

I noticed your reply and the part that describes opening the HTML-Page to a variable. This code works if you have the html-file somewhere on your harddisk, if i get it right...

@All:

Is it also possible to read a HTML-page _directly_ from the web to a variable - without opening any browser via script or something? Like autoit captures the html stream and "captures" it to a variable or something?

My goal is to create a little script, that reads a cerain webpage like every 10 minutes and reads a certain number from the page, to see if the page was changed.

Would that be possible somehow, or do i need to use a browser in the script to open, read and refresh the page somehow? I`m wondering if the mentioned IE.au3 (class?) thing has that kind of functionality by any chance...?

Any suggestions are welcome. Thanks a lot!

Edited by Savant2k6
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...