Trigger, a utility for macOS admins.

What does it do? Trigger is a command-line utility that presents a web view while simultaneously executing a shell command. You can give Trigger more than one web view and command to present, in which case it will move on to the next pair once the previous command finishes executing. If the web view content has form input elements, eg. a checkbox, placed within the <form></form> tags, Trigger can send the input val

How does one get it? Trigger is an open-source utility.

You can also get the latest pre-built .app here.

How exactly is it used? Below is the output of Trigger’s –help flag. I have also posted examples of how it can be used here

Usage:

Trigger.app/Contents/MacOS/Trigger webview1 command1 webview2 command2 ... [OPTIONS]

Trigger displays a web view while simultaneously executing a command. Once the command finishes executing Trigger moves on to the next web view/command pair.

WEBVIEW

The local HTML file or HTML string to display -f, –file OR -html, –html 

COMMAND

The command to execute. Command can be a shell command or a jamf binary command.

Example shell commands:

‘sleep 5’

‘/tmp/a_script.sh’

“/usr/sbin/installer -package ‘/tmp/CocoaDialog v2.1.1.pkg’ -target /”

Note the single quotes to wrap around the filename with spaces.

Accepted jamf commands:

All jamf verbs, although be warned that Trigger has only been tested with jamf binary versions 9.61 – 9.97, so far. Note: Trigger assumes that the binary is in /usr/local/bin/jamf. Specify fullpath if you relocated the binary.

Trigger needs to be run as root to run jamf commands.

Example jamf commands:.

“policy -trigger ‘microsoft office'”

‘policy -trigger vlc’

recon

There is one special Trigger commands: wait

wait displays the webView until a particular link on the presented HTML.

Trigger.app/Contents/MacOS/Trigger WEBVIEW wait

What occurs once the link is clicked depends on the url:
– A link to “next”, eg. <a href=”http://next”>NEXT</a>, makes Trigger proceed to the next web view/command pair.
– A link to “formParse”, eg. <a href=”http://formParse”>Submit</a>, will inspect any form values and return the results to stdout. before proceeding to the next web view/command pair.
– A link to “quit”, eg. <a href=”http://quit”>Done</a>, terminates Trigger.
Be sure to add http:// in the link URL (required by macOS 10.12.4+)

COMMAND,NAME

If an output file is specified (see ‘-o, –output’ option below), all named commands have their stdout and success status written to this file. A command is named by appending a comma followed by the name in quotations. eg. “policy -trigger mcafee”,”McAfee Security Agent”

OPTIONS

-t,–title <title> Title of the Trigger window. By default there is no title.

-h, –height Height, in pixels, of content window. Default height is 320px.

-w, –width Width, in pixels, of content window. Must be within the minimum and maximum width of the content window. Default width is 360px.

–noTitleBar, –notitlebar Hides the titlebar.

–fullscreen Puts the Trigger webView in fullscreen mode, and disables process switching, the dock, the apple menu, the menubar, and although the expose funtion key still works the user will be unable to switch to another application. Shift-command-Q for logout will work. There is no title bar when in fullscreen mode.

–blurry Applies a blurry overlay to the screen, behind the webView. Cannot be used in conjunction with –fullscreen.

-o, –output Creates an output html file. All named commands have their results written to it.

EXAMPLES

/usr/local/Trigger.app/Contents/MacOS/Trigger --file /tmp/power_prompt.html wait --width 800 --height 600
/usr/local/Trigger.app/Contents/MacOS/Trigger --file /tmp/progress_wheel.html 'sleep 5'
/usr/local/Trigger.app/Contents/MacOS/Trigger --file /tmp/installing_word.html "jamf policy -trigger 'word 2019'" --width 800 --height 600 --blurry
/usr/local/Trigger.app/Contents/MacOS/Trigger --file /tmp/installing_word.html "/usr/sbin/installer -package '/tmp/CocoaDialog v2.1.1.pkg' -target /" --fullscreen