Jump to content

Web-based AutoIt! - New with AuCGI!


theguy0000
 Share

Recommended Posts

Best thread ever. Thanks to all involved in getting this working. I can now quickly and easily create 240x240 web pages to control anything I wish using my pocketpc.

your welcome, and thanks for the comment :whistle:

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

minor update, forgot to make $iVarType optional so that previous code isn't broken.

There seems to be a problem with the update. Now there are 2 different _Get functions. This causes the web server to error.

Also there no longer seems to be a _Post function.

Link to comment
Share on other sites

There seems to be a problem with the update. Now there are 2 different _Get functions. This causes the web server to error.

Also there no longer seems to be a _Post function.

sorry about that, fixed now.

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

nope, you definitely said it :whistle:

@everyone . by the way, I made a site completely in autoit, and I think it's a very good example of what can be done. it's a video website. there is a page used by the owner to add a video, and when they do, the script goes through the youtube website servers to find the thumbnail, automatically adds the info for the video in an ini, and that will update the Video list page. it also updates the Recent Videos on the front page automatically. There is no database other than the ini.

It is a very good demonstration of almost all the features implemented on a more advanced level, and it demonstrates how easy these things can be in AutoIt that would be much much harder in, say, php.

here it is: http://turktv.theguy0000.com/

by the way, I'm updating that site almost daily, and new videos are being added often, so check back every once and awhile.

source available on request to people who I know I can trust...

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

the _Mail function is now completely useless by the way...somebody want to write a better one? I'm not sure how...

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

the _Mail function is now completely useless by the way...somebody want to write a better one? I'm not sure how...

You might be able to use:

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "")
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
        $objEmail.HTMLBody = $as_Body 
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
                SetError(1)
                return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
;Update settings
    $objEmail.Configuration.Fields.Update
; Sent the Message
    $objEmail.Send
    if @error then 
        SetError(2)
        return $oMyRet[1]
    EndIf
EndFunc;==>_INetSmtpMailCom
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 what can I use as $s_SmtpServer? will I have to install a server program just to use it? if so, then so will anyone else who wants to use the function...and that would get annoying

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

Or use any other out there, such as road runner, if you have one.

but then everyone who wants to use my email function will have to install a server...

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

Just use some freely available SMTP server. Like road runner, aim, gmail, etc.

smtp.aim.com

smtp.gmail.com

smtp-server.[w/e goes here].rr.com

But you have to have an account.

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

Just use one that is dedicated to just that function. Like autoit3@aim.com

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

  • 1 month later...

A question for the first post, probably to be answered by theguy0000:

I am pretty sure it is possible, but just to ask: Is it possible for people not having the AutoIt3 EXE to still view the web pages? Does the server parse the pages, or does the client do that?

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

A question for the first post, probably to be answered by theguy0000:

I am pretty sure it is possible, but just to ask: Is it possible for people not having the AutoIt3 EXE to still view the web pages? Does the server parse the pages, or does the client do that?

no, the pages are parsed by the server. Think of the danger if the client ran it. You could run virtually any piece of AutoIt code on the machine of whoever views the website!

In other words, ANYBODY can see the web pages, but the server has to have AutoIt3.exe.

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

Hey,

I modded _StartWebApp() a little bit to enable use of a stylesheet (for BlogIt, but other people might want it :shocked: )

Include this in your first post if you want to. Code:

Func _StartWebApp ($sTitle="", $sStyle = "", $sCookie = "", $sContent_type="text/html")
    Local $error = 0
    ;check if stylesheet exists
    $vCheckStyleExists = FileExists($sStyle)
    If $vCheckStyleExists = 1 Then
        ;exists.. wahoo!
    ElseIf $vCheckStyleExists = 0 Then
        ;file does not exist.
        $error = 2
        SetError($error, 2)
        Return 0
    EndIf
    ;check for stylesheet extension
    If $sStyle <> "" Then
        $vCheckStyleExt = StringRight($sStyle, 4)
        If $vCheckStyleExt = ".css" Then
            ;it's the correct file.. wahoo!
        Else
            $error = 2
            SetError($error, 1)
            Return 0
        EndIf
    EndIf
    if $sCookie <> "" then
        ConsoleWrite("Content-Type: "&$sContent_type & Chr(13) & Chr(10) & "Set-Cookie: " & $sCookie & Chr(13) & Chr(10) & Chr(13) & Chr(10))
        If @error then $error = 1
    else
        ConsoleWrite("Content-Type: "&$sContent_type & Chr(13) & Chr(10) & Chr(13) & Chr(10))
        If @error then $error = 1
    endif
    If $sTitle <> "" Then
        ConsoleWrite("<html><head>")
        If $sStyle <> "" Then
            ConsoleWrite("<link rel='stylesheet' type='text/css' href='" & $sStyle & "'><title>"&$sTitle&"</title></head><body bgcolor=#FAFAFA>")
        ElseIf $sStyle = "" Then
            ConsoleWrite("<html><head><title>"&$sTitle&"</title></head><body bgcolor=#FAFAFA>")
        EndIf
    EndIf
    If @error then $error = 1
    SetError ($error)
    Return 0
EndFuncoÝ÷ ØGbµ©l¢Ê&zw°zºè­ÊzÆ®¶­sc°"ÒçfÆB7GÆW6VWBfÆP£°WFVæFVC¢Òæ6÷'&V7BWFVç6öâÂ×W7B&Rb33²æ772b33²b333°£°WFVæFVC¢"Ò7GÆW6VWBFöW2æ÷BW7Bà
These are @error returns, by the way.

Thanks,

SANDMAN!

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

Added RSS Capabilities. You can now easily create your own RSS Feeds! See first post for code and usage.

Is there any script example which demonastrate real RSS feed from real site?

I have not used before RSS....Thanks

Edited by lsakizada

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

I have made some custom calltips for this.. these will be useful once this is finally made a built-in function :)

_StartWebApp( [ "page Title", "header HTML", "cookie specs", "content-type") Sends the HTTP header to the browser for web-based applications. (required: #include <web.au3>)
Echo("content" [, "tag") Sends text to be displayed in the web browser. HTML is allowed. (required: #include <web.au3>)
_Post("variable") Gets a value of a POST variable sent to a page. (required: #include <web.au3>)
_Get("variable") Gets a value of a GET variable sent to a page. (required: #include <web.au3>)
_Cookie("variable") Gets the value of a cookie. (required: #include <web.au3>)
_WebCounter( [ "message", "path") Echoes a string telling the user what visitor number they are. (required: #include <web.au3>)
_MsgBox("text") Displays a messagebox on the user's computer. Utilizes Javascript. (required: #include <web.au3>)
Die( [ "last message") Optionally echoes a string of text and then exits the script. (required: #include <web.au3>)
_StartWebApp_Session("title", "content-type") Sends a HTTP header to the browser with sessions enabled. (required: #include <web.au3>)
_GetSID() Gets the current user's session ID. (required: #include <web.au3>)
_Session_Set("variable", "value") Sets the value of a session variable. (required: #include <web.au3>)
_Session("variable") Gets the value of a session variable. (required: #include <web.au3>)
_Mail("recipient", "subject", "content", "sender") Sends mail to a specified recipient. (required: #include <web.au3>; server with IE and PHP enabled)
WebObjCreate("object", "object name") Creates an ActiveX object for later use. Object is CASE SENSITIVE! (required: #include <web.au3>; sessions enabled(_StartWebApp_Session()))
_URLEncode("string" or $string, type) Encodes a string to be URL-friendly. (required: #include <web.au3>)
_URLDecode("string or $string) Decodes a URL-friendly string to a normal string. (required: #include <web.au3>)
_StartRSSFeed("title", "link", "description" [, "language", "copyright", "editor", "master") Starts a web page that will be used as an RSS feed. (required: #include <web.au3>)
_RSSAddItem("title", "description" [, "link", "author", "category", "UID", "date") Adds an item to the current RSS feed. (required: #include <web.au3>; _StartRSSFeed())
_EndRSSFeed() Ends the RSS feed. (required: #include <web.au3>)

Hey, I was bored.. :D

Edit: Add these by going to Tools>User CallTip Entries in SciTE4AutoIt3 and pasting it in.

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/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...