Jump to content

Web-based AutoIt! - New with AuCGI!


theguy0000
 Share

Recommended Posts

thats cool. but will my functions work with that? I'm prett sure at least some of them only work for cgi. or is perl cgi? gah. lol

Well, your test page works. And I think that has every function in it.

My counter isn't going up, although I think you have to have the counter file existing for it to count? It doesn't make one if not exist, does it?

Sorry, I don't maintain an IIS server on the internet or I'd post a link. But, I have played with it a bit on my computer. I know I was looking for a way to do exactly this like 6 months ago. But now, I don't remember why. I must've found a work-around in the meantime or figured out how to write what I wanted in .asp :whistle:

Link to comment
Share on other sites

can you send me

:whistle: any bigger script working with this func,

thanks

Well, your test page works. And I think that has every function in it.

My counter isn't going up, although I think you have to have the counter file existing for it to count? It doesn't make one if not exist, does it?

Sorry, I don't maintain an IIS server on the internet or I'd post a link. But, I have played with it a bit on my computer. I know I was looking for a way to do exactly this like 6 months ago. But now, I don't remember why. I must've found a work-around in the meantime or figured out how to write what I wanted in .asp :)

Autoit.es - Foro Autoit en EspaƱol Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http
Link to comment
Share on other sites

Heres some of my HTML replacements:

Func StartWebAppBkColor($color, $title="Untitled")
    ConsoleWrite("Content-Type: text/html" & Chr(13) & Chr(10) & Chr(13) & Chr(10))
    ConsoleWrite("<html><head><title>"&$title&"</title></head><body bgcolor="&$color&">")
EndFunc

Func echo($text)
    ConsoleWrite($text)
EndFunc


Func _MsgBox($text)
  ConsoleWrite("<script>")
  ConsoleWrite('alert("'& $text &'")')
  ConsoleWrite("</script>")
EndFunc

Func Image($path)
    Echo("<Img src="&$path&">")
EndFunc

Func DispTextAsColor($color, $text)
    ConsoleWrite("<Font color="& $color &">"& $text &"</font>")
EndFunc

Func Center()
    Echo("<center>")
EndFunc

Func EndCenter()
    Echo("</center>")
EndFunc

Func LinkTo($path, $text)
    Echo("<a href="& $path &">"&$text&"</a>")
EndFunc
Link to comment
Share on other sites

theguy0000

Great work this is very cool

I also like what mother9987 posted about using it with IIS I also found that I can place the complied EXE in the inetpub/wwwroot and call it directly, I have not had much time to play with PUT, GET but it look promising for people stuck with IIS

Link to comment
Share on other sites

Here is a small example ho it would work with apache:

add the following code to the httpd.conf, located in (z.B. c:\intranet\apache\conf), ein:

ScriptAlias /au3/ "c:/intranet/au3/"
AddType application/x-httpd-au3 .au3
Action application/x-httpd-au3 "/autoit/autoit.exe"

if you want that au3 files are recognized as index files open httpd.conf and add to the line "DirectoryIndex" the following code:

index.php index.php4 index.phtml index.au3

havent tried it so far but should work.

kind regards,

JR

Edited by JRSmile
$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

:nuke: theres a bug... _Post can only be used once. *goes to fix bug

:P I must agree with Theguy0000, can anybody tell me why _Post function works only once, if I use your example form, then I can access just first "field" variable, the others are ignored.

I use autoit beta...

Thanx

Link to comment
Share on other sites

Honestly, this is a cool proof of concept, but I doubt using autoIT as an online scripting language is worth the time. It wasn't designed for it. Half the functions you posted are interesting, but essentially just using abbreviations and shortcuts to output html. Use php or python or ruby or whatever if you actually want a good dynamic website. I am not saying it isn't possible with autoit (your on a good start) but its like shaking a can of paint with a martini mixer.

Edited by Wus
Link to comment
Share on other sites

:P I must agree with Theguy0000, can anybody tell me why _Post function works only once, if I use your example form, then I can access just first "field" variable, the others are ignored.

I use autoit beta...

Thanx

Func _Post($var)
    If ConsoleRead( 0,true ) > 0 Then
        $varstring = ConsoleRead(EnvGet("CONTENT_LENGTH"), true)
    Else
        $varstring=""
    EndIf
    If Not StringInStr($varstring, $var&"=") Then Return ""
    $num = __StringFindOccurances($varstring, "=")
    Local $vars[$num+1]
    $vars = StringSplit ($varstring, "&")
    For $i=1 To $vars[0]
        $var_array = StringSplit ($vars[$i], "=")
        If $var_array[0] < 2 Then Return "error"
        If $var_array[1] = $var Then Return $var_array[2]
    Next
    Return ""
EndFunc

There's the _Post I'm using currently. It should be readable multiple times. Plus, you can run it from within SciTE without it hanging waiting for input.

I'm in the process of trying to convert a set of .asp pages over to .au3's just to see if I can get them working (for fun, as they work fine as .asp). Does anyone have any idea what I would do to make an equivalent of Response.Redirect "redirect url" from within AutoIT?

Link to comment
Share on other sites

Honestly, this is a cool proof of concept, but I doubt using autoIT as an online scripting language is worth the time. It wasn't designed for it. Half the functions you posted are interesting, but essentially just using abbreviations and shortcuts to output html. Use php or python or ruby or whatever if you actually want a good dynamic website. I am not saying it isn't possible with autoit (your on a good start) but its like shaking a can of paint with a martini mixer.

I use autoit inconjunction with php for some my pages :P

Edited by WTS
Link to comment
Share on other sites

I use autoit inconjunction with php for some my pages :P

Don't get me wrong I never said you couldn't. However, in the manner many of these "webfunctions" are being put forth, its not terribly effective. I could see a php script passing some values over to a autoit script to do some work (i.e. a form where 'action="doShit.au3"' when the au3 extension is registered to run), but I can't see the point in straight au3 pages involving HTML echoing. Autoit is not designed for web scripting, it can be modified to work like that I am sure, but why bondo up a square peg so it fits in a round hole?

I mean seriously, doing this

Func Center()
    Echo("<center>")
EndFunc

Func EndCenter()
    Echo("</center>")
EndFunc

is adding another whole layer of abstraction to do a very simple thing. And to be honest the <center></center> tags are deprecated anyway, use css/xhtml.

If you notice most of the funcs that have been put forth thus far do not exist in almost all server side scripting languages, because they are superfluous.

All I really wanted to do was to make sure people were not going to try to go out and use au3 files as serious attempts at webpage creation. Its not worth the time and effort, unless your doing it for kicks, since I have serious doubts that au3 will ever be designed for the web.

That said, it looks like a fun thing to play with and I will probably play with it myself.

Ideally what should be done is to create a preprocesser for au3 web based scrips so you can have <%au3 au3%> tags or the like. That way you dont have any need to echo everything and you can use the au3 tags like <?php ?> tags.

Edited by Wus
Link to comment
Share on other sites

...

I mean seriously, doing this

Func Center()
    Echo("<center>")
EndFunc

Func EndCenter()
    Echo("</center>")
EndFunc

...

That said, it looks like a fun thing to play with and I will probably play with it myself.

Ideally what should be done is to create a preprocesser for au3 web based scrips so you can have <%au3 au3%> tags or the like. That way you dont have any need to echo everything and you can use the au3 tags like <?php ?> tags.

I admit, when I started playing, I made a few functions for simple stuff, but then had to stop myself. I do still have one I'm using called _HTMLCloseAllTags( $sHTML ) that closes all the <B>'s and <TABLES> and whatever it recognizes in the string that are still open.

And I think one to turn a 2-dimensional array into a table would be useful, but yeah - There's really little point to a _HTMLBold( $sText ) or anything like that. But I wrote it and it's gonna remain in my include file until I decide to clean it lol!

I think a pre-processor would be fun. I noticed it's lack for sure when I was playing today.

Link to comment
Share on other sites

Its like shaking a can of paint with a martini mixer.

Why bondo up a square peg so it fits in a round hole?

[Offtopic]

Wow, I love your analogies.

[/Offtopic]

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Analogies can make or break an argument... I prefer to keep my audience entertained. Originality helps with the monotony of reading 50 threads (when only 5 or less are interesting).

Link to comment
Share on other sites

I'm in the process of trying to convert a set of .asp pages over to .au3's just to see if I can get them working (for fun, as they work fine as .asp). Does anyone have any idea what I would do to make an equivalent of Response.Redirect "redirect url" from within AutoIT?

Well, not perfect at all:

Func _ResponseRedirect( $sURL )
    ConsoleWrite("Location: " & $sURL & @CRLF & @CRLF )
EndFunc

It works, but you have to not send anything else to the web-page. No _StartWebApp. No Echo. No nothin'. But, it does work.

I suppose it could be augmented somehow... Make _StartWebApp, Echo, and the Redirect all work happily together somehow. I'll put some thinking on it :P

Link to comment
Share on other sites

Try sending it in the header.... that should do the trick i believe.

Global $__WebPageInitializationString=""
Global $__WebPageInitializationState="UNINITIALIZED"

Func _StartWebApp ($title="Untitled", $bDontCloseHeader=0)
    $__WebPageInitializationString = "Content-Type: text/html" & Chr(13) & Chr(10) & Chr(13) & Chr(10)
    $__WebPageInitializationString &= "<html><head><title>"&$title&"</title>"
    If $bDontCloseHeader=0 then $__WebPageInitializationString &= "</head><body>"
EndFunc

Func _ResponseRedirect( $sURL )
    If $__WebPageInitializationState = "UNINITIALIZED" Then
        ConsoleWrite("Location: " & $sURL & @CRLF & @CRLF )
        $__WebPageInitializationState="REDIRECTED"
    EndIf
EndFunc

Func echo($text, $bNewLine=true)
    If $__WebPageInitializationState <> "REDIRECTED" Then
        ConsoleWrite($__WebPageInitializationString & $text)
        If $bNewLine then ConsoleWrite(@CRLF)
        $__WebPageInitializationState="DATA SENT"
        $__WebPageInitializationString=""
    EndIf
EndFunc

This is the _StartWebApp, Echo, and _ResponseRedirect I've got apparently working. If you execute the _ResponseRedirect before any Echo's, you're golden. Otherwise, it gets ignored.

Otherwise, only minor mods to the _StartWebApp to accept an arguement to prevent it closing the <HEAD> so you can put other things you need in there if you want. And Echo to make it append a @CRLF by default as my HTML was ending up functional, but difficult to read :P

Link to comment
Share on other sites

I have so many questions - but I think the first one would be what can't you do with this. Are all the fuctions of AutoIt available?

will you can do all the things in AUTOIT all you have to is change the output so that it can be displayed on a webserver, so now you have the power to make programs with WEB interface, i.e. instead of having GUI you can create a webpage that has the GUI and use that as the front end for your program, you can do so many things remotely.

Link to comment
Share on other sites

Sorry, I fixed _Post but forgot to post it here :">

see first post. I also made _Get the same way, even though it worked before, but this way it doesn't have to read the environment variable each time, just a regular variable :P

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

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