Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Download Manager component

Updated on October 19, 2022

Use the Download Manager component to track when downloads start, stop, and fail in your automation, to take the appropriate next action.

In attended implementations, the project should be running and the adapter should be started before a download starts. The following scenarios are examples:

  • If a download starts before the adapter starts, and the adapter finishes before another download starts, no DownloadCompleted event fires.
  • If a download starts before the adapter starts, and then the download pauses, resumes, and finishes, only the DownloadResumed event and any events that come after it are executed.

Use the following properties, methods, and events when downloading files from the Google Chrome or Microsoft Edge browsers using the Download Manager component.

Properties

PropertyDescriptionReturn type
IsDownloadingIndicates whether any files are currently in the process of downloading. For example, if a download is in progress, this property equals True. If no downloads are in progress, the property equals False.Boolean
ItemsThe list of the Download Item objects that you can access by using the Download API. Robot Studio retrieves this list from the browser.Download Item object array
ItemsCountThe number of Download Item objects that are in the Items array.Integer

Methods

MethodDescriptionParametersReturn type
CancelDownloadUse this method to stop a download. Specify the download that you want to stop using the downloadID parameter.

downloadID

(Integer)
Void
ClearAllItemsFromListUse this method to clear all the items from the download list.

The system does not delete the file from the disk. For more information, see FileUtils component.

NoneVoid
ClearItemFromList

Use this method to clear a specific file download from the list. Specify the download that you want to remove using the downloadID parameter.

The system does not delete the file from the disk. For more information, see FileUtils component.

downloadID (integer)Void
ClearItemsFromList

Use this method to clear all the items added between the times specified in the fromDateTime and toDateTime parameters from the download list.

To clear all downloads from the list before the toDateTime, leave the fromDateTime parameter blank.

To clear all downloads from the list after the fromDateTime, leave the fromDateTime parameter blank.

fromDateTime

toDateTime

Void
GetDownloadDetails

Use this method to return all the available information provided for the downloadID that you specify. The details include information that is stored in the following properties:

  • FilePath
  • CurrentStatus
  • StatusDateTime
  • URL
  • FinalURL
  • TotalFileSize
  • BytesReceived
  • PercentComplete
  • InterruptReason
  • EstimatedEndTime
downloadID (integer)See property discussions for individual return types.
PauseDownloadUse this method to pause a download. Specify the download that you want to pause by using the downloadID parameter.downloadID (integer)Void
ResumeDownloadUse this method to resume the downloading of a file. Specify the download that you want to resume by using the downloadID parameter.downloadID (integer)Void
ResumeDownloads

Use this method to resume all interrupted downloads that you specified in the fileList parameter.

Use the resumeAttempts parameter to specify how many additional times the system should try to download each file. For example, if you enter three (3), the system tries to restart the download four (4) times. If you do not specify the number of attempts, the system tries to resume the download only once. There are no timeouts or pauses between attempts.

The system stops processing this method after it finishes processing all interrupted files and all files on the list to download, or after the timeout interval is met, whichever occurs first. The timeout parameter defaults to 30000 milliseconds.

The system returns one of the following statuses:

  • Completed – If all items on the list finished downloading.
  • Interrupted – If all files finished downloading (or attempting to download) and at least one item on the list was interrupted.
  • Timedout – If the system is still downloading items when the timeout interval expires, regardless of other files being in an interrupted/completed state.

The system expects files that are still downloading when the timeout interval expires to complete on their own.

The FileList input parameter contains the list of objects to be evaluated and resumed. FileList is also an output that returns the current state of all files in the list.

Note: Pass the FileList into a list loop and create a proxy to get download item information.

WaitForDownloads

Use this method to accumulate a list of downloads, starting when the system begins to execute the block and continuing until the downloadStartTime interval expires. During this time interval, the system adds any downloads that are initiated to the FileList.

Setup actions occur on an asynchronous thread that triggers the download.

The system only allows one WaitForDownloads method to be within the downloadStartTime interval at a time. This means that if two automations call the WaitForDownloads method at the same time, the second method call will not proceed until the downloadStartTime interval on the first call finishes. This helps to confine the FileList associated with the method call to only the files downloaded by the setup action.

The system returns one of the following statuses:

  • Completed – If all items on the FileList finish downloading.
  • Interrupted – If all files finished downloading (or attempting to download) and at least one item on the list was interrupted.
  • Timedout – If the system is still downloading at least one item when the timeout interval expires. Other files in the list may also be interrupted or completed.
  • NoDownloadStarted -- If there are no items that began downloading when the downloadStartTime interval expires.

The system expects files that are still downloading when the timeout interval expires to complete on their own.

Use the downloadStartTime parameter to specify, in milliseconds, how long to wait for downloads to start. The default is 5000 milliseconds.

Use the timeout parameter to specify, in milliseconds, the maximum amount of time to wait for a download to appear on the FileList. The default is 30000 milliseconds.

The FileList parameter contains the list of objects that began downloading while the block was in the downloadStartTime interval.

In an attended automation, if the user manually starts a download within the downloadStartTime interval, that download is also added to the list. Pass the FileList into a list loop and create a proxy to get download item information.

Events

EventDescription
DownloadCancelledEventThis event fires when a download is cancelled. Returns the downloadID, the Download Item object, and the Filepath.
DownloadCompletedThis event fires when a download completes. Returns the downloadID, the Download Item object, and the Filepath.
DownloadInterruptedThis event fires when a download is interrupted. Returns the downloadID, the Download Item object, and the Filepath.
DownloadPausedEventThis event fires when a download pauses. Returns the downloadID, the Download Item object, and the Filepath.
DownloadResumedThis event fires when a download resumes. Returns the downloadID, the Download Item object, and the Filepath.
DownloadStartedThis event fires when a download starts. Returns the downloadID, the Download Item object, and the Filepath.
DownloadStatusChangedThis event fires when a download status changes. Returns the downloadID, the Download Item object, the Filepath, the PriorStatus (none, started, paused, interrupted, canceled, and so on), and the current Status.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us