How to run a command automatically after a download completes

How to run a command automatically, after a download completes in firefox desktop browser.

Note: I am not an add-on developer.

I used to be able to do this with add-on Download Status Bar (DSB) by Szalgiris user cmd. You can define any user cmd to run as the “virus scan” cmd. See https://addons.thunderbird.net/en-us/seamonkey/addon/download-status-bar/ - Download Status Bar by Szalgiris. Pic of options screen below:

This add-on is no longer supported under latest Firefox is there another add-on or another way I could do this?

I need an add-on that can, after downloading file, trigger a script and pass name of downloaded file, so this is sequence:
. Firefox download complete then
. Run user defined command on this download (parameters for name and file checksum needed ). Examples: create a log file; run a windows batch file; run ad-hoc virus scan; or run a command script for TTS the name of the file downloaded.

Is it technically possible for a web-extensions add-on to implement this like the old add-on?

This is similar to the discussion on https://askubuntu.com/questions/641723/how-to-run-a-command-automatically-after-completing-download where one suggestion mentioned:
https://addons.mozilla.org/en-US/firefox/addon/context-command-executor/
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging

That is hard to setup and is NOT integrating into download process. Although another alternative is have a separate download manager and change content type action (https://support.mozilla.org/en-US/kb/change-firefox-behavior-when-open-file#w_changing-download-actions) it’s a work laptop and installing a separate download manager is not an option. I would really like a simple method I can use on both Home and Office PC.

I am currently using Download Status Bar (S3) but it does not have a user defined command option like “Download Status Bar by Szalgiris”

Is there an add-on that currently solves this?

1 Like

The numerous “Open with” extensions use the native messaging approach (i.e., you install a companion application). I don’t know whether any of those are generic enough to work for you.

I assume you’re talking about an add-on like “open with Chrome” where a url link is passed to an intermediate node.js app listening on a local port for data which it then passes to google Chrome browser app. I have only seen those add-ons triggered by selecting a menu action or button action. Is it possible to write an addon that will automatically trigger when a download completes in the browser and then trigger an “open with” action?

I might be able to fork “Download Status Bar (S3)” and adapt some code snippets into the existing add on if I can get a clear idea what is possible and what is not possible under web extension restrictions. I doubt “Download Status Bar (S3)” developer would be interested in the enhancement.