Running a shell script

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

User avatar
Utnapishtim
Fanatic
Fanatic
Posts: 141
Joined: 2018-07-12, 02:42
Location: Win7

Running a shell script

Unread post by Utnapishtim » 2021-12-28, 07:56

Is there an add-on that lets me run a shell script or executable when I click on a certain domain?

For example, I'd like that when I click on a youtube link, instead of continuing to the youtube website, PM would run a short batch script I've prepared that downloads the video to a certain folder and opens it in VLC

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: Running a shell script

Unread post by moonbat » 2021-12-28, 08:48

I don't think there are any extensions that do exactly that but there's a workaround - you can install GetEmAll and have it download the video to a specified folder and then use inotifywait as described here. (The package to install it from on Ubuntu derivatives if absent is inotify-tools).
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
jars_
Lunatic
Lunatic
Posts: 397
Joined: 2016-12-27, 00:12

Re: Running a shell script

Unread post by jars_ » 2021-12-28, 13:12


User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: Running a shell script

Unread post by moonbat » 2021-12-28, 22:28

jars_ wrote:
2021-12-28, 13:12
Custom Buttons
Can it invoke scripts from the local filesystem? Since that's what his original request was about.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
jars_
Lunatic
Lunatic
Posts: 397
Joined: 2016-12-27, 00:12

Re: Running a shell script

Unread post by jars_ » 2021-12-29, 10:02

Can it invoke scripts from the local filesystem?
Yes.
1. with Path2file

Code: Select all

/* CODE */
startProcess("C:\\docs\\my_script.cmd", []); //gBrowser.currentURI.spec

function startProcess(path, args) {
    var file = Components.classes["@mozilla.org/file/local;1"]
        .createInstance(Components.interfaces.nsILocalFile);
     file.initWithPath(path);
    if(file.exists()) {
       var process = Components.classes["@mozilla.org/process/util;1"]
              .createInstance(Components.interfaces.nsIProcess);
       process.init(file);
        process.runw(false, args, args.length);
      } else custombuttons. alertBox ("File not found", path); 
 };

2. with cmd\bat text, from Help-tab (in CB editor)

Code: Select all

/* CODE */
  var file = Services.dirsvc.get('ProfD', Ci.nsIFile);
       file.append("profileBak.cmd");
           custombuttonsUtils.writeFile( file.path, convertFromUnicode("866", self.Help) );
       file.launch();

/* HELP */
......cmd/bat text .........


User avatar
sidology
Moon lover
Moon lover
Posts: 79
Joined: 2021-12-04, 22:07

Re: Running a shell script

Unread post by sidology » 2021-12-30, 08:48

Utnapishtim wrote:
2021-12-28, 07:56
Is there an add-on that lets me run a shell script or executable when I click on a certain domain?
moonbat wrote:
2021-12-28, 08:48
I don't think there are any extensions that do exactly that
Actually, there are.

Both can automatically open chosen web sites in a browser of choice / video player / downloader / executable.

IE View 1.5.1 (last "clean" version) (LGPL 3.0) and IE View Lite 1.3.5 (MPL 1.1) with its super lean code, but the "OK" button in the preferences doesn't work.

IE View Lite.png

Download:

Code: Select all

IE View 1.5.1
https://ca-archive.us.to/storage/0/35/ie_view-1.5.1-sm+fx-windows.xpi?origin=caa&action=download

IE View Lite 1.3.5 (needs a fix):
https://ca-archive.us.to/storage/1/1429/ie_view_lite-1.3.5-fx.xpi?origin=caa&action=download

User avatar
Utnapishtim
Fanatic
Fanatic
Posts: 141
Joined: 2018-07-12, 02:42
Location: Win7

Re: Running a shell script

Unread post by Utnapishtim » 2022-01-04, 13:52

Thanks guys :D I've installed both IE View 1.5.1 and CustomButtons. Had some problems getting IE View to work initially, but that turned out to be the fault of my batch file

Also a big <3 to all Pale Moon & XUL maintainers! I'd bet this would be a big no in a WebEx browser

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: Running a shell script

Unread post by moonbat » 2022-01-04, 23:20

Utnapishtim wrote:
2022-01-04, 13:52
I'd bet this would be a big no in a WebEx browser
Web Extensions are just glorified Greasemonkey scripts, given they can't do much beyond modifying webpages. They cannot modify or extend the browser UI in any way, let alone interact with the OS like these ones do. That's why you only see them as buttons, or at the most launch in a separate tab.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Running a shell script

Unread post by Moonchild » 2022-01-05, 15:49

moonbat wrote:
2022-01-04, 23:20
Web Extensions are just glorified Greasemonkey scripts, given they can't do much beyond modifying webpages.
A hint is in the name... WEB extensions.
As opposed to BROWSER extensions.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
biopsin
Fanatic
Fanatic
Posts: 119
Joined: 2016-02-07, 17:15

Re: Running a shell script

Unread post by biopsin » 2022-01-06, 10:14

Legacy version-6.8.6 of openwith https://github.com/darktrojan/openwith/tree/legacy does what you seek.
voidlinux_x64 glibc-2.38 / Palemoon_latest release (gcc-13.2.0) / GTK2

Locked