Advertisement |
What is "External Application Button" extension and how does it work?
This browser extension introduces an action button that offers two functions: opening the options page or executing a selected task. Users can create as many execution jobs as they desire within the options page. In addition to the toolbar's action button, users can specify context-menu items for different actions, such as context-over-page, context-over-image, and context-over-media. These items enable users to open an external application and transmit customized arguments to the application.
recommended The "Save Tabs" extension for Chrome, Edge, and Firefox browsers.
The "Save Tabs" extension allows you to save and restore tabs across different windows, helping reduce memory usage or revisit tabs later while preserving their state. It also supports syncing across devices and offers optional password protection for session security, all without affecting browser performance when not in use. Read more here.
Is it possible to create multiple toolbar buttons using the extension?
No, the extension only allows for a single action button. However, users can easily switch between multiple applications using the right-click context menu over this button. Users can define many applications in "toolbar" mode and switch between them by right-clicking on the toolbar button. When the user clicks this button, it will either open the options page (if no program is available for the "toolbar" mode) or execute the default external application and pass the defined arguments.
How do I run a new external application using the extension?
To run a new external application, go to the options page, fill out all the required fields, then click the "Add Application" button. The "Display Name" field specifies the name that will be displayed either in the tooltip of the action button or as the name of the context menu item. The "Executable name/path" field is the absolute path to the external application. For example, on Windows, if you want to open Firefox that is installed in the default location, you can use "C:Program Files (x86)Mozilla Firefox irefox.exe" in this field. The "Arguments" field includes arguments to pass to the external application. To open a link with an external application, use the "[HREF]" reserved word. The "Placement" field indicates the location where the extension appends the new application to the browser: Either to the context menu, action button, or both. Finally, the "Icon" field specifies the image of the action button when the application is set as the default application. It is recommended to use a 32px PNG format, and there is a file size limitation of 5KBytes for each image file.
Can I alter the configuration of an application later?
Yes, modifying different parameters for an application is easy. Open the options page and select the application from the "List of applications" menu. Then, make the necessary changes to the parameters and click the "Update Application" button.
What's new in this version?
Please check the Logs section.
[deprecated] Why do I need to give the installer script administrator permission? Is there anyway to install this script without this permission?
Windows: The installer script requires admin permission to perform two tasks. However, you can bypass this requirement by manually performing the necessary steps. To do this, place the "app" folder somewhere on the disk, and then create a registry entry to let your browser know where the actual program is located. The steps to create this registry entry are described in this link. If you only plan to use the app with a single browser, you only need to create a single registry entry. If your registry is pointing to the correct location for the "app" folder, the extension should be able to detect the native client without any issues.
Mac and Linux: On macOS and Linux, the script requires "sudo" access, equivalent to the admin permission on Windows. To bypass this permission requirement, place the "app" folder in a local directory, generate a JSON identifier based on your operating system, then place it in the appropriate directory. The locations for the Chrome and Opera browsers on Linux are specified in this link, while the location for Firefox on Linux is specified in this link. For macOS, the locations for Chrome and Opera are specified in this link, while the location for Firefox is here. For more information, refer to this code. The install.js
file copies a few files to two different locations. However, since copying to both locations requires admin permission, you need to manually create and copy the files.
The installer script checks if NodeJS already exists in your PATH environment variable before copying it. If it is found, then the file is not copied. Therefore, if you have NodeJS installed and configured in your system's PATH, you do not need to copy the NodeJS executable again.
How can I install the native client?
Instruction on how to install the native client will be displayed once the toolbar button is clicked. If you want to see it in action watch these two short tutorials
Windows: https://www.youtube.com/watch?v=18jAqTXBiZA
Linux and Mac: https://www.youtube.com/watch?v=bB4Bj_APg4g
Can I change the icon for a context menu item that I added using the options page?
No, currently it is not possible to change the icon for a context menu item in Chrome. This is a limitation of the API, and there is no known workaround. For more information, please refer to the documentation at developer.chrome.com.
How can I open a Terminal window in Mac OS?
Opening a visible terminal window is useful. On macOS use the following command to open a new Terminal window and execute a command like echo
in it:
Use /usr/bin/osascript
as the executable path and use this code in the arguments section:
-e 'tell application "Terminal" to do script "echo [HREF]"'
How can I open an intractive command line (CMD) window in Windows OS?
Use C:\Windows\System32\cmd.exe
as the executable path and for the arguments use /s/c start
. Note that you can append a batch file path to the argument list to run an interactive batch script.
It is sometimes hard to find an icon with the required size when adding a new application. Are there any recommendations for finding suitable icons?
One recommendation is to use the website www.iconfinder.com/ to search for icons in different sizes. However, in future releases, the icon requirement for context menu items will be removed, as the icon is not being displayed. More information can be found at https://github.com/andy-portmen/native-client/issues/3.
How can I send selected text to my favorite text editor like Notepad++ or Sublime Text
You need to create a script that accepts the input text and opens the external application
On Windows, create a bat script with the following content:
echo %* > C:\Users\MYUSERNAME\Desktop\test.txt
start "" NotePad++ C:\Users\MYUSERNAME\Desktop\test.txt
On Mac OS, create a shell script with the following content:
echo "$@" > ~/Desktop/log.txt
open -a "Sublime Text" ~/Desktop/log.txt
Now open the options page and create a new entry. Use "Selection Context" as the context menu item and point the executable path to the created script. Use [SELECTIONTEXT]
in the arguments section.
Is it possible to add support for more protocols for the link context menu selection?
You can add custom schemes to the pattern box next to the context menu selection on the options page. For example, to support the "ed2k" scheme, insert ed2k://*
in the text box. If you also want to support "HTTP" and "HTTPS" schemes, you can use the pattern ed2k:*, *://*/*
.
Can I check the actual arguments that are sent to the executable?
Yes. Use the following code as a batch script (create a new file with the following content and call it test.bat). Use the path of this batch script as the executable path and check the generated file when the command is executed by pressing the toolbar button or clicking the context menu item.
echo %* >> C:\Users\%USERNAME%\Desktop\output.txt
This is particularly useful to make sure the extension passes the correct arguments to the actual executable.The "External Application Button" extension allows multiple placements for the context menu. What will be sent to the external application if the arguments list includes the keyword [URL]
?
When using the "link" context, the closest link's href
attribute will always be used. For "image", "video", and "audio" contexts, the src
attribute will be used (if available), without considering the "link" context. For all other contexts, the URL of the page or frame will be used. Therefore, if you want to send the URL of a thumbnail image to the external application, you should use either "link" or "link" plus "image" contexts. On the other hand, if you want to send the image URL to a photo editor, you should only use the "image" context (without including the "link" context).
Can I stop the "setup guide page" from appearing after running an external application using this extension?
The "setup guide page" appears when the external executable returns an exit code other than zero, indicating something went wrong. To prevent this page from showing up, go to the options page and select the "ignore errors" option for the specific application.
Can the extension send the surrounding quotations for the path in the arguments list?
By default, the extension doesn't add surrounding quotations as it sends each argument separately. However, if your external executable requires quotes around the path, you can use the options page to force the extension to send them. Keep in mind that you can test the arguments with the "Test Arguments" button to see what is sent to the external executable.
How does the [DOWNLOADED_PATH]
keyword work in the "External Application Button" extension?
When [DOWNLOADED_PATH]
keyword is included in the arguments list, the extension will download the linked file using the built-in download manager and then send the absolute path of the downloaded file to the external application. This can be useful, for example, to automatically open a downloaded PDF file using the default PDF viewer application.
What is the meaning of the [PROMPT]
keyword in the argument list?
If you include the [PROMPT]
keyword in the arguments list, it will display a prompt dialog for the user to enter a string before the command is executed. The resulting string will be passed to the external executable. This can be useful for prompting the user to enter a filename before sending a link to the external executable. It is also possible to include multiple [PROMPT]
keywords if you need to ask for multiple inputs.
Can I use my own extension to run native commands using "External Application Button" as a middle man?
Yes, this extension supports running native commands from other extensions/applications with user confirmation. To use this feature, see this sample code:
chrome.runtime.sendMessage('EXTERNAL_APPLICATION_BUTTON_GUID', {
app: {
args: '[HREF]',
path: 'firefox'
},
tab: {
url: 'http://www.example.com'
}
});
This code uses a faked tab object. Instead, you can send the actual tab id that is prepared by the chrome.tabs...
API. In this example. The extension opens Firefox browser using open -a firefox [URL_HERE]
command which is how an application should be called in Mac OS. Note that based on your browser, you will need to provide the correct value for EXTERNAL_APPLICATION_BUTTON_GUID.Is it possible to open a URL in a particular Firefox profile using this extension?
You need a bash script for that. For Mac OS it would be like this:
#!/bin/bash
PROFILE="$1"
URL="$2"
RESULT=`ps -A | grep firefox`
if echo $RESULT | grep $PROFILE ; then
echo "send the link to an existing instance"
open -n -a Firefox --args -P "$PROFILE" -new-tab "$URL" &
else
echo "send the link to a new instance"
open -n -a Firefox --args -no-remote -P "$PROFILE" -new-instance "$URL" &
fi
The script uses the ps -A
command to check if Firefox with the profile that is requested is available or not. If yes, it uses "-new-tab" command and if not it uses "-new-instance" command. This script can be adapted to work with other operating systems too.
[Firefox Only] Can you explain why all the applications executed from this extension in Firefox get closed when the browser is closed? Is there a way to prevent this from happening?
This behavior relates to how Firefox handles native applications as child processes of Firefox. When the parent process is closed, the operating system (Windows only) kills all the child processes, including those launched by this extension. There is no easy way to bypass this restriction. However, a workaround is to use a third-party program called RunFromProcess by NirSoft that can change the parent process of a child process. You can call this program instead of your native one and ask it to assign another parent process for the application. By doing this, when Firefox is closed, the os does not kill the child process because its parent is still running. You can set a persistent process such as "explorer.exe" as the parent to prevent it from being closed later.
How can I enable context menu items to appear on local pages and data URI pages (e.g. data:,Hello%2C%20World!)?
To enable context menu items to appear on local pages and data URI pages, you can use the <all_urls>
keyword as the page pattern for the items that need to be injected on local pages.
Use case: Backup your Firefox profile from a toolbar button
Here is a small tutorial on how to back up the Firefox profile whenever you needed it into a new dated folder.
Example of how to run a Python script from this extension:
Create a sample Python script that displays all the input arguments in a notification box and save it locally. Like:
import sys
import os
def notify(title, text):
os.system("""
osascript -e 'display notification "{}" with title "{}"'
""".format(text, title))
notify("My Sample Python Script", str(sys.argv))
Now open the options page and add /usr/bin/python3 as the executable. For the arguments use path_to_the_python_script/sample.py [HREF]
. Note that the script path is inserted in the arguments list not in the executable field since the actual executable is python3
. You can assign the extension's browser action button (toolbar button) to execute this script. By clicking on the extension's toolbar button, you should get a desktop notification containing the script path and the URL of the active tab.How can I send a link to an external application by left-clicking on the link?
The extension supports a new placement option called "navigation" in version 0.4.0. Enabling this option and setting wildcard filters that match the link pattern allows the extension to intercept navigation and send the link to the external application instead.
Can I install the native client of this extension on a machine with an unsupported architecture?
If the installer of the extension fails because of an unsupported CPU architecture, you can still install the native client by downloading the version of NodeJS that works on your system from the official website. After downloading the native client for your operating system, extract it into a local directory and replace the NodeJS executable with the working one. Then follow the instructions to complete the installation.
How can I send the output of the pre-script to the external application?
As of version 0.5.0, you can use document.currentScript.output = "my custom string output";
to extract text content from the pre-script code and use it as the [PRE_SCRIPT]
argument. If you need to use this argument in a URL, convert the output using encodeURIComponent
JS method.
On version 0.5.3, you can pass an array of strings to the document.currentScript.output
to extract more data from the current document and read them from your application using [PRE_SCRIPT:0]
, [PRE_SCRIPT:1]
, and ... keywords.
Is it possible to use a keyboard shortcut to run the external command instead of pressing the toolbar button?
Yes, on Chromium browsers, open "chrome://extensions/shortcuts" in a browser tab and assign a custom shortcut for this extension. On Firefox, open "about:addons" in a browser tab, click on the gear icon, and select the "Manage Extension Shortcuts" button.
Can the action button's command be executed on multiple tabs simultaneously?
Starting from version 0.5.1, it is now possible to execute the command assigned to the action button on all selected tabs in the current window. Use Ctrl+Click or Shift+Click to select the tabs you want to include, then press the action button.
Can I use this extension to show desktop notifications on Linux?
To enable desktop notifications on Linux, install and use the notify-send
command. This command is typically part of the libnotify-bin
package. For instance, on Ubuntu or Debian-based systems, you can use the following command:
apt-get install libnotify-bin
You can use a bash script to facilitate the desktop notifications. Here's a sample script:
#!/bin/bash
message=$1
sudo -u user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "$message"
The DBUS_SESSION_BUS_ADDRESS
environment variable specifies the address of the session bus, allowing notify-send
to send notifications to the correct user's desktop. Additionally, specifying the user with sudo -u user
ensures that the notification is displayed within the context of the user's desktop session, maintaining proper permissions and access control. For more info, visit issues/103.
What does the "Manage Triggers" button do on the options page?
The "Manage Triggers" button is a new feature that allows you to automate the execution of external commands without user interaction. For example, you can configure it to create a file each time a user visits a page. To use this feature, open the options page and click the "Manage Triggers" button to access the trigger manager interface. Currently, there are three types of triggers available:
document.currentScript.output
.These triggers enable you to automate actions without requiring user interaction. Additionally, each trigger provides the native application with extra information about the caller through an "[EXTRA]" argument. For download triggers, the extra argument is a base64 encoded JSON of the download object. For the JavaScript trigger, it is the base64 encoded value returned by document.currentScript.output
. For more details, please refer to the next FAQ.
What is the meaning of the "[EXTRA]" keyword in the argument list?
The "[EXTRA]" keyword represents additional data that this extension provides to the external application. This data is always base64 encoded to ensure it is sent as a single argument.
document.currentScript.output
.Please keep reviews clean, avoid improper language, and do not post any personal information. Also, please consider sharing your valuable input on the official store.