Open .mal4s files automatically: Mac - secure411dotorg/mal4s GitHub Wiki


Making .mal4s files open with mal4s

To use mal4s as the default application to open a file type, first we need to set up a application file. This is done through Automator. Finder -> Applications -> Automator.

Automater may start with a window offering that you could open an existing Automator file. On that window, click the Done button. Automator closes. Start it again.

Automator should prompt you to pick a document type. Choose Application.

automator-to-applicaton

In the search bar next to Actions and Variables, type Run Shell Script. Double click it.

There is a pull down next to Pass input:. The default is to stdin, so change that to as arguments, then delete the text in the box below. Open a terminal window, and type which mal4s. Likely it will return /usr/local/bin/mal4s. In the text box of the Run Shell Script enter the path returned from which mal4s followed by "${1}" like this:

/usr/local/bin/mal4s "${1}"

automator-mal4s-actions

If you need to set additional command line arguments, you can do that before the ${1}, if not, the script is done. File -> Save, and in the Save As: text box, type Mal4s, and in Where:, select Applications. Leave File Format: as Application and click Save.

Locate a saved .mal4s file in the Finder, double click the file. It will open a dialogue telling you there is no application associated with that file type. Select Choose Application..., and locate Mal4s in the list of Applications, select it and click Open. Mal4s should launch and open the file.

Website syntax to make your Mal4s files open automatically

<!DOCTYPE html>
<HTML>
    <BODY>
        <a href="http-test.mal4s" download="http-test.mal4s">Download file</a>
...

The above works with Firefox and Chrome on Mac.

Opening from Firefox

Assuming the web server is configured to present *.mal4s files as mime type text/mal4s, Firefox likely will start Mal4s with the data file if you click on a link to the data file. Bear in mind that the config file used will be the one set up in your Automator application above. Your config file must have full paths to any resources such as the user images and background image.

Opening from Chrome

The first time you save a file ending in mal4s in Chrome, you will need to let it download to a folder. If you are seeing the data displayed as text in Chrome, press command-s to Save it.

Now look in the lower left corner of the Chrome window. Click the down arrow next to the file name you just downloaded and then click on "Always Open Files of This Type". If you look again, it should have a checkmark next to it.

always-open-chrome

Remember that your Chrome settings may be associated with any Google user you are logged in as, and may change if you log out or login as a different user.

⚠️ **GitHub.com Fallback** ⚠️