|Index > Scribe > The new scripting function 'GetUri' on the application object.|
|Author/Date||The new scripting function 'GetUri' on the application object.|
|There is a new scripting method attached to the application object. It allows the script to download a URI and then process the result asynchronously.
The methods arguments are:
App.GetUri(Uri, CallbackName[, UserData])
First 2 arguments are strings. UserData is an option argument.
The callback arguments should be:
Callback(App, Uri, Content, UserData)
Where 'Uri' is the original Uri passed to GetUri and Content is the raw data. The callback is called after the download thread finishes. So there maybe some time between the GetUri call and the callback happening. If the download fails currently the callback is not called. But I'm open to changing that. And/or adding more parameters to the callback, like the headers or something.
'UserData' is just passed unchanged to the callback.
|I've changed the behavior and arguments of the callback to:
Callback(App, Uri, Status, Content, UserData)
So the new parameter 'Status' is a boolean that is true if the URL was downloaded. If it's true the Content argument contains the URL data. If it's false, the Content is an error message.