Jump to content

Powerful HTTP Server in Pure AutoIt


jvanegmond
 Share

Recommended Posts

Very nice manadar. I sent you a PM also.

Why can't you send a file, do some stuff with Autoit and then send a different .html file to change the view. I am tring to make a file downloader thing, where when you go to 192.168.1.100, or the IP Address, it will have this as the loading screen:

<h1>Loading Index....</h1>
<html>
<body bgcolor="gray">
</body>
</html>

Then it will retrieve all the files off the system, and then send the main index.html with all the files, with hyperlinks.

This is part of it:

<html>
<body>
<p>
<a href="http://192.168.1.100/C:\Users\Darin\abbrev.properties">
C:\Users\Darin\abbrev.properties</a>
<br>
<a href="http://192.168.1.100/C:\Users\Darin\NTUSER.DAT">
C:\Users\Darin\NTUSER.DAT</a>
<br>
<a href="http://192.168.1.100/C:\Users\Darin\ntuser.dat.LOG1">
C:\Users\Darin\ntuser.dat.LOG1</a>
<br>
<a href="http://192.168.1.100/C:\Users\Darin\ntuser.dat.LOG2">
C:\Users\Darin\ntuser.dat.LOG2</a>

But, I would also like it to have a search box, where it would search and display all the results, as well as able to download files from the webpage. Like if I clicked "C:\Users\Darin\ntuser.dat.LOG2" it would go to here: http://192.168.1.100/C:\Users\Da...ntuser.dat.LOG2 and download it, and send it to the client using the webpage. So far it just sends a empty file. Not sure why. I'd really like to use this manadar. Thanks.

EDIT: Just saw your PM Manadar. :mellow:

Edited by TehWhale
Link to comment
Share on other sites

Very nice manadar. I sent you a PM also.

About downloading the empty file, that has been fixed in the code I sent you.

Let me expand on the PM a bit. It was a bit short. To make a "Loading index..." page, you would need the client to do something special. If your only language is AutoIt you can best write a piece of Javascript in the HTML page to make it refresh the index page every second, until a proper index.html is generated (in a different process)

Also, you don't actually have to write the index.html page to the hard drive. You can just as well send it as a variable. :mellow:

If you're good with asynchronous Javascript and XML you could make a real "Loading index..." page. Where Javascript would download a list of all the files from the webserver as they are generated.

Link to comment
Share on other sites

About downloading the empty file, that has been fixed in the code I sent you.

Let me expand on the PM a bit. It was a bit short. To make a "Loading index..." page, you would need the client to do something special. If your only language is AutoIt you can best write a piece of Javascript in the HTML page to make it refresh the index page every second, until a proper index.html is generated (in a different process)

Also, you don't actually have to write the index.html page to the hard drive. You can just as well send it as a variable. :mellow:

If you're good with asynchronous Javascript and XML you could make a real "Loading index..." page. Where Javascript would download a list of all the files from the webserver as they are generated.

Ah, well I have no experience with Java or XML. Maybe you could help me. Also, it's downloading great, but is it possible to have a working search box too?
Link to comment
Share on other sites

Ah, well I have no experience with Java or XML. Maybe you could help me. Also, it's downloading great, but is it possible to have a working search box too?

I have no experience with Javascript or XML either. lol. Definitely can't help you with that without learning a new language.

It's possible to make a working searchbox. But first of all, I'd like to suggest that you read all files in the directory and paste them into a .txt file or something. So you can search through it easily. Also, you should do that in a separate process, or, do it using Adlib or something to split it into short chunks..

Link to comment
Share on other sites

I have no experience with Javascript or XML either. lol. Definitely can't help you with that without learning a new language.

It's possible to make a working searchbox. But first of all, I'd like to suggest that you read all files in the directory and paste them into a .txt file or something. So you can search through it easily. Also, you should do that in a separate process, or, do it using Adlib or something to split it into short chunks..

One question thought too, is when I set the page, why can't I change it again? Like, I load the loading.html, and then after I read all the data, it wont change it to the index.html or whatever.
Link to comment
Share on other sites

One question thought too, is when I set the page, why can't I change it again? Like, I load the loading.html, and then after I read all the data, it wont change it to the index.html or whatever.

Your webserver can only reply to incoming requests from the client. It can't send 2 outgoing pages if it has only received one request.

You must tell the client (using Javascript) to reload the page, until loading is completed.

Link to comment
Share on other sites

<body onload="window.location.href='index.html';"> should do the trick.

I had this...

<html>
    <head>
        <script language="Javascript">
        <!--
            function reloadFunction() {
                location.href = 'index.html' + '?' + ((new Date()).getTime());
            }
        //-->
        </script>
    </head>

    <body bgcolor="gray" onload="setTimeout('reloadFunction()',1000)">
        <h1>Loading Index....</h1>
    </body>
</html>
Link to comment
Share on other sites

yes, it can also done without javascript however :)

<html> 
<head> 
<title>Loading Index...</title> 
<META http-equiv="refresh" content="5;URL=index.html"> 
</head> 
<body bgcolor="#ffffff"> 
<center>
The Index is being loaded. this takes approximately five seconds.<BR>
If you do not wish to wait, click <a href="index.html>here</a>
</center> 
</body> 
</html>

Gives the same result as:

<html> 
<head> 
<title>Loading Index...</title> 
<script type="javascript/text">
function redirect() { location.href = 'index.html';}
</script>
</head> 
<body onload="setTimeout('redirect()',5000)"> 
<center>
The Index is being loaded. this takes approximately five seconds.<BR>
If you do not wish to wait, click <a href="index.html>here</a>
</center> 
</body> 
</html>
Edited by toonboon

[right]~What can I say, I'm a Simplistic person[/right]

Link to comment
Share on other sites

Posted Image

Got it all working manadar. Time to just make it look good, and also make a search thingy, that works good and looks good. And, is there anyway I can access this from my school? I know on every network they use 192.168.1.100 as the first comp, and so on, but my IP is 192.168.1.100 is there anyway I can get a IP like: 84.65.456.55 or something, that will connect to my computer and allow me to play music from my browser at school?

Link to comment
Share on other sites

Posted Image

Got it all working manadar. Time to just make it look good, and also make a search thingy, that works good and looks good. And, is there anyway I can access this from my school? I know on every network they use 192.168.1.100 as the first comp, and so on, but my IP is 192.168.1.100 is there anyway I can get a IP like: 84.65.456.55 or something, that will connect to my computer and allow me to play music from my browser at school?

ipupdater.com (or another popular one I haven't used is no-ip.com) will let you download free software on your home computer that points a subdomain (for instance, tehwhale.ipupdater.com) to whatever public address your home network (usually the WAN port on your router) is on. Then forward port 80 through your router to the private address (192.168.x.x) of your actual computer, and viola! No paying for or remembering a static ip address...just type in your chosen address and access your computer! :)
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Then forward port 80 through your router to the private address (192.168.x.x) of your actual computer, and viola! No paying for or remembering a static ip address...just type in your chosen address and access your computer! :)

http://portforward.com/ is a good website that helps you forward port 80 to your home computer.

DynDNS is the technique to assign a domain name to a dynamic IP. There are a few websites available that do this, but your router needs to support it. Otherwise, if you do not need a DNS, you can simply type in the http://81.x.x.x/ address in your browser at school.

Edit: Mirror'd: Posted Image

Edited by Manadar
Link to comment
Share on other sites

  • 3 months later...

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