The openasyncprogresswindow statement opens a floating progress window for asynchronous operations (urltask(, timers).


This statement has one parameter:

options – a dictionary that contains options for controlling the operation of the window (see details below).


This statement opens a floating progress window for asynchronous operations (urltask(, timers). This is similar to the progress window the Finder displays when copying files. When this statement is invoked, it opens a small window that displays a progress bar. Your code then continues and performs a long running task, most commonly downloading a large item from the internet. As the task runs it periodically updates the progress value. When the task is finished it closes the progress window. There can be multiple asynchronous operations running at once, the openasyncprogresswindow will open as many windows as necessary, positioning them automatically.

After opening the progress window, the openasyncprogresswindow will automatically create a local variable named asyncTaskInfo that your code can access. This variable will contain a dictionary with the information your code needs to update the progress and to close the window. The items in this dictionary are:

Downloading a URL in the Background

Here is code that will download 4 url’s in the background, with progress windows displaying the progress. This code takes the window closing code passed back from the openasyncprogresswindow and modifies it to also diplay a notification, then passes it to the urltask( function so that the window will close and notification will appear when the download is complete. It also passes the progress variable name to urltask( so that the progress window will update as the download proceeds.

let urls = 
looparray urls,cr(),url
    openasyncprogresswindow initializedictionary(
    let progressWindowNumber = getdictionaryvalue(asyncTaskInfo,"WINDOWNUMBER")
    let finishWindowCode = getdictionaryvalue(asyncTaskInfo,"FINISHCODE")
    let progressVariable = getdictionaryvalue(asyncTaskInfo,"PROGRESSVARIABLE")
    let urlCode = replace(
    {   let pageSize = length(fileglobalvalue("_DialogAlertLib","pageContents}+progressWindowNumber+{"))
        nsnotify "Downloaded "+pageSize+" bytes."
    let taskid = urltask(url,

This code doesn’t actually save the downloaded URL’s anywhere, but that is a simple modification. See the urltask( function for details.

Option Parameters

The openasyncprogresswindow statement has one parameter, which allows you to modify the operation of the progress window. Leave this dictionary empty for default operation. The items you can include in this dictionary are:

See Also


10.2NewNew in this version.