Jump to content

Is InetGet's second parameter really optional?


therks
 Share

Recommended Posts

I just tried

ConsoleWrite(InetGet("http://www.autoitscript.com/forum/style_images/autoit/logo4.gif"))
and it returned 0, and, not surprisingly, didn't download the file (at least anywhere I looked).

Is the second parameter really optional? I mean, sure, I know it's optional in the sense that it CAN be left out and you'll get no error... but really, what's the point? I had thought maybe if I left it empty then the file would be downloaded to temp files, with it's default name or something, but no dice.

On a related note, does anyone know how I could retrieve the filename if I don't know it? For example if I wanted the default filename from a download link that went through a web script like http://somesite.com/downloadFile.php?fileID=123

*Edit: On an unrelated note, I just found out that somesite.com reroutes to 127.0.0.1. Boy was I surprised to click on that link and see an error page from my webserver, haha.

Edited by Saunders
Link to comment
Share on other sites

You make a pretty good point.

I compiled 2 scripts:

SUCCESS.exe

$result = InetGet("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe", @DesktopDir & "\TEST1234.exe")
ConsoleWrite($result)oÝ÷ ØP-ì^jëh×6$result = InetGet("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe")
ConsoleWrite($result)

Then I ran Filemon on each. I did not see any obvious errors.

The output didn't really differ until after this line:

9:05:44 AM SUCCESS.exe:196 CLOSE C:\WINDOWS\system32\Wininet.dll SUCCESS

Success.exe calls this next line whereas fail.exe doesn't.

9:27:35 AM SUCCESS.exe:3376 FASTIO_QUERY_OPEN C:\Documents and Settings\mjhorn\Desktop\Secur32.dll NOT FOUND Attributes: Error

Fail.exe makes no CREATE calls after that point so I don't think any file is being written.

Link to comment
Share on other sites

Not a bug as it is valid for the "abort" of the download.

<_<

MHZ did you read the question? In the help file:

[optional]

Local filename to download to.

Except, you have to have a local filename, otherwise it does nothing, no temp file is created, nothing.

Link to comment
Share on other sites

MHZ did you read the question? In the help file:

[optional]

Local filename to download to.

Except, you have to have a local filename, otherwise it does nothing, no temp file is created, nothing.

The questions that are not specific in detail of interpretation IMO. But to not use a filename as the 2nd parameter leaves the logic to explain that hey..., no destination proposed so where to save the download? So where does the download get saved? Reading the remarks can help solve the misinterpretation.

Interpretation seems the problem here so what suggestions would be suitable to prevent further prevent misinterpretation? It looks like a catch22 to make a crystal clear understanding of the meaning of optional for the 2nd parameter without reading the remarks.

<_<

Edit:

Perhaps to show a double use of InetGet() like as shown for ObjEvent() (in the yellow boxes).

i.e.

ObjEvent ( $ObjectVar, "functionprefix" [, "interface name"] )

ObjEvent ( "AutoIt.Error" [, "function name"] )

and for InetGet()

InetGet ( "URL" ,"filename" [, reload [, background]] )

InetGet ( "abort" )

Edited by MHz
Link to comment
Share on other sites

Right, I totally forgot about the abort capability, and that's a case where a second parameter is really not needed. I still think that calling it optional seems a bit misleading though. Maybe a slight rewording would be less confusing.

filename:
[optional if aborting download]
Local filename to download to.
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...