Jump to content

Recommended Posts

Posted (edited)

How would I make a script get all the files in a url, say here, and have my program list all the files in that directory?

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted

  On 10/26/2009 at 6:24 PM, 'exodius said:

Assuming that any additional files on that page will follow the same format:

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ("http://corgano.co.cc/new/")
$sHTML = _IEDocReadHTML ($oIE)

$sRegExp = StringRegExp ($sHTML, '(?:\"\>)(.*)(?:\<\/A>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

Any way of doing it without opening internet explorer? (or any other window)

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted (edited)

If you're trying to avoid opening an IE window... Would you be able to at least save a file to the computer with INetGet and then read it in with _FileReadToArray and then parse it out like I did, or do you need to get the html completely without saving something to the computer?

***Edit - I would also point out that you can have that IE window be hidden if you change the _IECreate to _IECreate ("http://corgano.co.cc/new/", 0, 1), you'd just want to add _IEQuit($oIE) to the end of what I posted so you didn't end up with orphaned iexplore.exe processes.

Edited by exodius
Posted

  On 10/26/2009 at 7:17 PM, 'exodius said:

If you're trying to avoid opening an IE window... Would you be able to at least save a file to the computer with INetGet and then read it in with _FileReadToArray and then parse it out like I did, or do you need to get the html completely without saving something to the computer?

***Edit - I would also point out that you can have that IE window be hidden if you change the _IECreate to _IECreate ("http://corgano.co.cc/new/", 0, 1), you'd just want to add _IEQuit($oIE) to the end of what I posted so you didn't end up with orphaned iexplore.exe processes.

I tried to have the window hidden ($oIE = _IECreate ("http://corgano.co.cc/new/",0,1))but it didnt work.

What would I use inetget on?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted

My bad, I gave you the wrong code for the _IECreate, what I gave you would have told it to make it be visible instead of hidden.

This should work:

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ("http://corgano.co.cc/new/", 0, 0)
$sHTML = _IEDocReadHTML ($oIE)

$sRegExp = StringRegExp ($sHTML, '(?:\"\>)(.*)(?:\<\/A>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

_IEQuit($oIE)
Posted

That worked. Thank you. If anyone else has a method then feel free to post it.

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted (edited)

You could do this too:

#include <Array.au3>

$varOutput = "temp.html"

InetGet ("http://corgano.co.cc/new/", $varOutput)
$varFile = FileRead ($varOutput)

$sRegExp = StringRegExp ($varFile, '(?:\"\>)(.*)(?:\<\/a>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

FileDelete ($varOutput)
Edited by exodius
  • 3 months later...
Posted

  On 10/27/2009 at 4:58 AM, 'exodius said:

You could do this too:

#include <Array.au3>

$varOutput = "temp.html"

InetGet ("http://corgano.co.cc/new/", $varOutput)
$varFile = FileRead ($varOutput)

$sRegExp = StringRegExp ($varFile, '(?:\"\>)(.*)(?:\<\/a>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

FileDelete ($varOutput)

Just visiting the thread again because I am going to do a complete rewrite of the script. Thanks! I like how it needs no includes (array.au3 is only for arraydisplay)

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...