Jump to content

HTML to AU3


AutoItKing
 Share

Recommended Posts

I am just teeming with web based ideas this week!! Here's another:

HTML to AU3

This will take your HTML pages and convert them into AutoIt web pages. It puts echo (' ') around each line and also adds the necessary include and _StartWebApp().

The output file requires Web Based AutoIt from theguy0000.

Enjoy!

html_to_au3.au3

If you want to use Javascript just use this: (PHP, ASP, etc. will not work with this)

#Include <web.au3>
_StartWebApp ()
echo (FileRead("file.html",FileGetSize("file.html")))
Edited by AutoItKing
http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

nice job..

There's one brave enough to set foot upon forbidden territory. Anyone else?

http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

I see that you _StartWebApp('Title Goes Here') but if the html page is already made, wouldnt it be safe to assume that the html page already has those beginning html tags? then if they do, you will end it with something like

<html>
<head>
<title>Title goes here</title>
</head>
<body>
<html>
<head>
<title>the title of the page that was already there</title>
</head>
<body>
etc.....

Oh, and you Do...until loop doesn't allow for blank lines in the html...try For $i=1 To _FileCountLines(blah) or something

other than that, pretty cool script

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

Seems like overdoing it by adding the echo's. Just read the .html into a buffer then spew it out using echo.

Link to comment
Share on other sites

Good idea! But then you'd need the HTML file there too. And not only the Au3

http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

Good work @AutoItKing

I made a couple of minor changes to your script

Run to ShellExecute and removed the Restart function

#include <file.au3>

$file = FileOpenDialog("Choose File...","","HTML Pages (*.html;*.htm)")
$fileopen = FileOpen($file,0)
$saveto = FileSaveDialog("Save as...","","AutoIt Scripts (*.au3)")
If FileExists($saveto) Then $answer = MsgBox(301,"OverWrite?","That file already exists!!" & @CRLF & @CRLF & "Would you like to over write it?")
If $answer = 6 Then
    FileDelete($saveto)
    FileOpen($saveto,2)
    FileWriteLine($saveto,"#Include<web.au3>")
    FileWriteLine($saveto,"_StartWebApp()")
    For $i=1 To _FileCountLines($file)
        $line = FileReadLine($fileopen)
        $line2 = StringReplace($line,"'",'"')
        FileWriteLine($saveto,"echo ('" & $line2 & "')")
    Next
ElseIf $answer = 7 Then
    If @Compiled Then
        ShellExecute(@ScriptFullPath)
    Else
        ShellExecute(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit @exitCode
ElseIf $answer = 2 Then
    Exit @exitCode
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

But I liked the restart function... :whimpers:

lol

And you got the old one.

Edited by AutoItKing
http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

Very nice concept. I am missing something tho. Once I have converted my HTML to au3, I should be able to run the file and it function like the HTML file right? My HTML file includes javascript does this work with javascript? the erro I get is #Include <web.au3> Error reading the file. Any advice?

Thank You

Jim

Link to comment
Share on other sites

You need web based autoit. And I think javascript might work since it is run on the client computer.

http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

But I liked the restart function... :whimpers:

lol

And you got the old one.

I have the new one now and made the same changes but you can keep the function if you like :whistle: . Personally I prefer to shorten the code.

I'm going to play with the javascript question when I have time but right now that looks like sometime around the the next February 31st.

I'd also like to play with using the dll version with this.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

If you want to use Javascript just use this:

#Include <web.au3>
_StartWebApp ()
echo (FileRead("file.html",FileGetSize("file.html")))
http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
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...