Back
AppleScript Within
Introduction

You can feed great potential Progressive Downloader can give to you if you known AppleScript.

Feel interested? Open application preferences and click “Show More” on the General tab. Then switch to the Integration tab to find the appropriate option. Check the box to enable script execution and the Edit button. Upon your click on the Edit button you will see AppleScript editor launching with a template script. That’s where the magic lives. AppleScript panel

There are two places where you can apply your knowledge:
Pre-Download
In the pre-download sub-routine, which is called “Start”, you are free to change the following values:

The sub-routine has one argument with all current values, with exception for usr and pwd, so you can use them to decide whether you need to apply your script.

In order to change a value the sub-routine must return the new value within the result dictionary. For example, use the following to change source address for all tasks to “http://www.example.com”:

return {address:"http://www.example.com/"}

This approach is suitable to all but cookies. The cookies value is a record. The next line sets cookie with name “foo” and value “bar”.

return {cookies:{foo:"bar"}}

Do not return anything if none of the values are supposed to be changed.

Avoid using the Progressive Downloader suite within this script or the application will hang.

Post-Download

The post-download sub-routine is called on successful finish and has one argument which is the path to downloaded file. You can use this one to check downloaded data for viruses. The following example shows how to do it using ClamXav:

tell application "ClamXav"
activate
open path
end tell