Jump to content

Web-Based au3 compiler


NELyon
 Share

Recommended Posts

Ok, so i totally rewrote this as the old one had so many errors it wasn't even funny.

#Include <Web.au3>

$srcfile = @ScriptDir &"\source\tmp.au3"
$compilerdir = "c:\Program Files\Autoit3\Aut2Exe\Aut2ExeA.exe"

_StartWebApp("Web Autoit Compiler")

If Not FileExists($srcfile) Then
    FileWrite($srcfile, ";Start of script" & @CRLF)
EndIf

If Not FileExists($compilerdir) Then
    echo("Error. Compiler not found")
    Exit
EndIf

If _Post("code") Then
    ;Write the code to a tempory file
    FileDelete($tmpfile)
    FileWrite($srcfile, _Post("code"))
    If Not @Error Then
        Run($compilerdir & ' /in "' & $srcfile & '"')
    EndIf
    echo("Ok, click here for the compiled script <a href=/source/tmp.au3>Click Here</a><br>")
    exit
EndIf


echo("<form action=" & $_SCRIPT_NAME &" method=POST>")
echo("<textarea width=500 height=500 name=code><br>")
echo("<input type=submit value=compile></form>")

Hopefully fixed the obvious problems.

Edited by Senton-Bomb
Link to comment
Share on other sites

ill post it and let u test it

page is here

line 3 err incorrect parameters

My Example:

http://65.31.38.216/test2.au3

#Include <Web.au3>
#Include <WebGui.au3>
Local $sAut2exeA = @ProgramFilesDir & "\AutoIt3\Aut2Exe\Aut2exeA.exe"
$num = iniread( @scriptdir & "\Settings.ini", "Compiles", "ID", "2459723" )
$num = $num + Round( Random( 523, 23433 ), 0 )
IniWrite( @scriptdir & "\Settings.ini", "Compiles", "ID", $num )
$srcfile = @Scriptdir &"\script\tmpfile" & $num & ".au3"
If FileExists($srcfile) Then FileDelete( $srcfile )
If Not FileExists($srcfile) Then
    FileWrite($srcfile, ";Beginning code"&@CRLF)
EndIf
_StartWebApp_Session("Online Compiler - Home Web Server")

Echo( '<a href=index.au3>Old Server Consle</a> | <B><a href="server.au3">New Server Command Consle</a></B> | <a href="test2.au3">Online AutoIT Compiler</a></P><br>' )
If _Post("cmp") Then
        ;If Not StringInStr( _Post('code'), 'FileInstall(' ) Then 
        ;If FileExists($srcfile) Then FileDelete( $srcfile )
        _msgbox($num)
        FileWrite($srcfile,@CRLF & _Post("code"))
        Sleep(100)
        $infile = $srcfile
        ;$outfile = "" & $ReadInput1 & ".exe"
        $outfile = @ScriptDir & "\Script\Compiled" & $num & ".exe"
        $param = '/in "' & $infile & '" /out "' & $outfile & '"'
        ShellExecute($sAut2exeA, $param)
        echo( "If you get the 404 Error That means that it could not be compiled due to an error<BR><b>Your File ID is:</B><br> <a href='http://65.31.38.216/Script/Compiled" & $num & ".exe'>" & $num & "</a>" )
        $num = $num + Round( Random( 523, 23433 ), 0 )
        IniWrite( @scriptdir & "\Settings.ini", "Compiles", "ID", $num )
        $srcfile = @Scriptdir &"\script\tmpfile" & $num & ".au3"
    ;Else
        ;Echo( 'FileInstall Command Is not permitted!' )
    ;Endif
EndIf
echo("<H3>||DBaks||<br>") 
echo("Online AutoIT Compiler BETA</H3>")
Echo('<br>')
Echo('AuotIt Version:' & @AutoItVersion )
Echo("<BR><B>ONLINE COMPILER IS NOT CURRENTLY WOKING FOR files with 26+ Commands!</B><BR>If your script has any errors the compiler will NOT report these.  Also Comment Blocks over 15 lines long tend to cause errors!  File Install Command block for security reasons.")
echo("<form action="&$_SCRIPT_NAME&" method=POST>")
echo('<textarea name=code value="'&'" cols=125 rows=45></textarea><br>')
;echo("<textarea name=code2 width=900 height=700></textarea><br>")
echo('<input type=submit name="cmp" value="Compile" >')



If _Post('SubmitC') Then
    $name = _Post('Name')
    $msg = _Post('Comment')
    If StringInStr( $msg, "</script" ) <> 0 Then $msg = StringReplace( $msg, "script", "" )
    If StringLen( $name ) = 0 or StringLen( $msg ) = 0 Then 
        _MsgBox("You have to have a name and a comment!")
    Else
    IniWrite( @Scriptdir & "\Comments2.ini", "Comments", Round(Random(1000,9999), 0), $name & '|' & $msg )
    Endif
Endif




$Cmts = IniReadSection( @Scriptdir & "\Comments2.ini", "Comments" )
If IsArray( $Cmts ) Then
For $it = 1 to $Cmts[0][0] step 1
    $Dat = StringSplit( $Cmts[$it][1], "|" )
    Echo( '<Hr /><br><b>Name:'&$DAT[1]&'</b><br>'&$Dat[2] )
Next
Else
    Echo(  '<Hr /><b>No Comments</b><BR>' )
endif

Echo( '<hr />')
_WebGuiCreateInput( 'Name', 'Your Name' )
Echo( '<br>' )
_WebGuiCreateEdit( 'Comment', 'Your Comment Goes here' )
Echo( '<br>' )
_WebGuiCreateButton( 'SubmitC', 'Add comment' )
_WebGuiEndGroup()
Echo( '<Br><p align="Center"><a href=index.au3>Old Server Consle</a> | <B><a href="http://www.autoitscript.com/forum/index.php?showtopic=55873">View This On The AutoIT Forum</a></B> | <a href="test2.au3">Online AutoIT Compiler</a><br></p>' )
Edited by DBak

[center][/center]

Link to comment
Share on other sites

@all

Thanks for the hints.

I had already Web.au3 available.

As you might already know by now I don't have Abyss.

Nevertheless I recently discovered the smalest webserver on the planet, supporting CGI and is only +50K large !!

I was hoping to get it to run on this "TinyWeb" server here : TinyWeb

But I need your help to get it running, because I don't have any clue to get started with the CGI stuff.

I have this server runing as it should, very easy because it is a standalone EXE file.

What next ?

regards

ptrex

Link to comment
Share on other sites

well why are you hosting on such a small server?? there are others that have much more room... or you could just ask me for ftp permissions to one of my servers that have web based autoit lol.... You could use one of mine if you'd like, otherwise remember that the autoit3.exe has to be on the server, and the server software has to support adding an interperter....

When i get home in about an hour ill try to set up the ftp for my computer and make you a folder on my server for testing scripts... I'm sure you cant hurt my server, its a P4 3.0 dual, 512ddr and win xp pro... I'll give you 10 gigs space.. just give me a day to get it all set up for yah!

Edited by DBak

[center][/center]

Link to comment
Share on other sites

@DBak

Thanks for the offer, very generous of you. But thanks I am not looking for disc capacity are space.

The reason why I don't want to install Abyss on my PC is that multiple apps doing basicaly the same thing is overkill.

It only consumes needles CPU and RAM resources.

Therefor I am more into Small Apps. Like Au3, SQLite, TinyWeb etc...

Of course the downsite is that those sometimes have their limitations.

Once I have TinyWeb going with AU3 I will let you know.

regards,

Ptrex

Link to comment
Share on other sites

Sorry for the bugs, i'll fix it asap. Ubuntu is a tough demon when it comes to Autoit.

DBak, could you give me like 5 megs of ftp space so i can do testing?

I only need it for testing web based stuff.

Link to comment
Share on other sites

<B>Here is what we fixed up last night</b> its http://65.31.38.216/sentonbomb.au3

#Include <Web.au3>

;If Not FileExists(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Autoit v3\", "InstallDir") &"\Aut2Exe\Aut2exe.exe") Then
;    _StartWebApp("Error")
;    echo("error! Compiler not found at "& RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Autoit v3\", "InstallDir") &"\Aut2Exe\Aut2exe.exe")
;EndIf

$srcfile = @Scriptdir &"\script\tmpfile.au3"
Local $sAut2exeA = @ProgramFilesDir & "\AutoIt3\Aut2Exe\Aut2exeA.exe"
If Not FileExists($srcfile) Then
    fileopen( $srcfile, 10 )
    FileWrite($srcfile, ";Beginning code"&@CRLF)
EndIf
    fileopen( $srcfile, 10 )
_StartWebApp()

If _Post("code") Then
    echo('<br>Step 1 of 3')
    Do
    FileWrite($srcfile, _Post("code"))
    Until FileExists($srcfile)
    ;Run(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Autoit v3\", "InstallDir") &'\Aut2Exe\Aut2exe.exe /in "'& $srcfile&'"')
    echo('<br>Step 2 of 3')
    $infile = $srcfile
    $outfile = @scriptdir & '\script\tmpfile.exe'
    $param = '/in "' & $infile & '" /out "' & $outfile & '"'
    echo('<br>Step 3 of 3')
    ShellExecute($sAut2exeA, $param)
    echo('<BR>Compiling')
    Do
    echo('.')
    sleep(1000)
    Until FileExists(@Scriptdir &"\script\tmpfile.exe")
    sleep(1000)
    echo("<BR>Download file here: <a href=/script/tmpfile.exe>Click Here</a>")
EndIf

echo("<form action="&$_SCRIPT_NAME&" method=POST>")
echo("<textarea name=code width=400 height=400></textarea><br>")
echo("<input type=submit>")

and one more thing take a look at my webgui.au3 its in my sig as HTML Form UDF

Edited by DBak

[center][/center]

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...