AppleScript

Leech has a basic but quite functional AppleScript dictionary.

 

The Dictionary

Leech's AppleScript dictionary
 

Some Examples

Most of these commands are quite simple, as they have no parameters. For example, to pause the queued downloads, you'd just do this:

tell application "Leech"
  pause all
end tell

And to resume the paused queue:

tell application "Leech"
  queue all
end tell

The download URLs command, however, is more complicated as it accepts a number of parameters. Here's a slightly more complex example that downloads a list of URLs to a specified folder:

set targetFolder to "/User/your_user/Documents/Some Folder"

set theURLs to
  "https://a.com/file1.txt, ¬
  https://b.com/file3.txt, ¬
  https://c.com/file8.txt, ¬
  https://d.com/file4.txt, ¬
  https://e.com/file2.txt"}

repeat with TheSite in theURLs
  tell application "Leech"
    download URLs {TheSite} to POSIX path targetFolder
  end tell
end repeat

To use this, you'd obviously have to modify the path and the list of URLs. Please see Leech's dictionary in Script Editor for more details on all of downloadURLs parameters. (Note that the URLs do not need to be on separate lines; they're shown that way here for easier reading. You can get rid of the AppleScript line break character (¬) and just have them in one long string.)

If you're a user of both Keyboard Maestro and Leech, you're in luck: A user named @tiffle on the Keyboard Maestro forums has created a set of custom plug-in Leech actions for Keyboard Maestro that make it easy to interact with Leech without knowing anything about AppleScript.

You'll find all the details about the plug-in actions, including help and examples of how to use them, in this post on the Keyboard Maestro forums.

While we didn't write these, we have used them, and they work quite well for interacting with Leech through Keyboard Maestro.