Jump to content

asynchronous _InetGetSource


lgodfrey
 Share

Recommended Posts

I am using wOuter's _InetGetSource UDF as a starting point to try to create a true asynchronous version of InetGet (InetGet does not release control back to the code until the URL responds, so it is not true asynchronous mode). wOuter's UDF uses the winhttp.winhttprequest.5.1 object (really the WinHttpRequest com obj portion of winHTTP, I think) , needs the beta version of AutoIt to run.

I've got it to run asynchronously (just have to add a 1 or "true" parameter to the open statement: $o_HTTP.open ("GET", $s_URL,1) or $o_HTTP.open ("GET", $s_URL,"true")). But I can't figure out how to get the status of the download. The property "Status" only works if the download is complete so that is not the the answer. I think that the event "OnResponseFinished" (and/or some of the other events) might be usefull, but MS http://msdn.microsoft.com/library/default....winhttp_5_1.asp does not give any examples of how to use such an event in a script.

1) Can anyone tell me how to use an object event in AutoIt, or give me a link to somerwhere that explains how to use an event? I haven't been able to find anything.

Also, it is "easy" to get an error while using the winHTTP object. For instance, if you try to use the Status or ResponseText property prior to completion of the download, the script exits with an "AutoIT error" "The requested action with this object has failed.". If you use set the timeouts too tight using SetTimeOuts method, then you can get an error even on the Send method in synchronous mode.

2) Is there a posting I can't find on how to trap object errors like this so AutoIt does not exit?

Also, my testing indicates that asynchronous open method is indeed asynchronous (control is returned to the code as soon as the send method sends out the open command).

3)Can anyone confirm that indeed this is true, and there are no hidden waits like in InetGet? I want to make absolutely sure I am going down the right path as a workaround to InetGet mixed-mode issue.

Any help would be greatly appreciated.

Best Regards

Larry

I'm, Lovin' IT, X

Link to comment
Share on other sites

Any update on this? I would like it.

<{POST_SNAPBACK}>

I guess you are talking about the asynchronous download, not the events in the help file. I was going to do asynchronous download with timing measurements to do my own timeouts/restarts. However, I ended up using winhttp timeouts to come very close to my original intent: Look here for a post on getting past an error using the winhttp.winttprequest.5.1 object. The version of winhttp that I have apparently does not support events(figure that). Sven gave me the code as a starting point for my own custom UDF. Hope his code helps you.

Regards

Larry

I'm, Lovin' IT, X

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