Skip to content

Build your own Applets

Abdy Franco edited this page Apr 7, 2019 · 13 revisions

To create your own applets, it is highly recommended that you use IFTTT Platform as it allows you to create more versatile applets. You can sign up for IFTTT Platform in the following link: http://maker.ifttt.com

Available Commands

macOS IFTTT Control works thanks to m-cli, so it's possible to use any m-cli command with IFTTT, plus some extra macOS IFTTT Control commands. The commands available at this moment are:

Bluetooth:

usage: bluetooth [ status | on | enable | off | disable | help ]

Examples:
  bluetooth status    # bluetooth status
  bluetooth on        # turn on bluetooth
  bluetooth enable    # turn on bluetooth
  bluetooth off       # turn off bluetooth
  bluetooth disable   # turn off bluetooth

Disk:

usage: disk [ ls | list | info | fs | filesystems | ejectall | verify | repair | help ]

Examples:
  disk ls                                 # list disks
  disk list                               # list disks
  disk list /dev/disk0                    # list a specific disk

  disk fs                                 # list available filesystems for formatting
  disk filesystems                        # list available filesystems for formatting

  disk info /dev/disk0                    # display information

  disk ejectall                           # eject all mountable volumes

  disk verify volume /Volume/MyVol        # verify volume
  disk verify disk /dev/disk0             # verify disk

  disk repair volume /Volume/MyVol        # repair volume
  disk repair disk /dev/disk0             # repair disk

  disk format MS-DOS MYNAME /dev/disk2              # format the entire disk with a windows format (MS-DOS)
  disk format volume MS-DOS MYNAME /Volumes/myvol   # format the volume with a windows format (MS-DOS)

  disk reformat /Volumes/myvol            # reformat a volume
  disk rename CURRENTNAME NEWNAME         # rename a volume

Display:

usage: display [ status | help ]

Example:
  display status   # status of displays
  display help     # show usage

Dns:

usage:  dns [ flush | help ]

Examples:
  dns flush       # flushes local DNS

Dock:

usage: dock [ showdelay | autohide | magnification | position | addblankspace | addrecentitems | prune | help ]

Examples:
  dock showdelay x.x          # Changes how long the Dock takes to show up when auto-hide is enabled
  dock autohide YES           # Enable Dock's auto hide feature
  dock autohide NO            # Disable Dock's auto hide feature
  dock magnification YES      # Turn magnification on
  dock magnification NO       # Turn magnification off
  dock position BOTTOM        # Change Dock's position to the bottom of the screen
  dock position LEFT          # Change Dock's position to the left of the screen
  dock position RIGHT         # Change Dock's position to the right of the screen
  dock addblankspace          # Add a blank space (separator) to the Dock
  dock addrecentitems         # Add a stack containg your recent items to the Dock
                                #  (You can change the stack's type by right clicking on it)
  dock prune                  # Removes all apps from Dock

Dir:

usage: dir [ tree | size | delete | help ]

Examples:
  dir tree        # tree view of folders in the current path
  dir tree /path  # tree view of folders in a specific path

  dir delete empty          # delete empty folders recursively in the current path
  dir delete empty /path    # delete empty folders recursively in a specific path

  dir delete dsfiles        # delete .DS_Store files recursively in the current path
  dir delete dsfiles /path  # delete .DS_Store files recursively in a specific path

  dir size        # calculate current folder size
  dir size /path  # calculate folder size in a specific path

Finder:

usage: finder [ showhiddenfiles | showfileextensions | showdesktop | showpath | help  ]

Examples:
  finder showhiddenfiles           # get the current status
  finder showhiddenfiles YES       # show hidden files
  finder showhiddenfiles NO        # no show hidden files

  finder showextensions            # get the current status
  finder showextensions YES        # show all file extensions
  finder showextensions NO         # don't show all file extensions

  finder showdesktop               # get the current desktop status
  finder showdesktop YES           # enable the desktop
  finder showdesktop NO            # disable the desktop

  finder showpath YES              # show the current opened folder path on the top bar of the Finder window
  finder showpath NO               # show the current opened folder name on the top bar of the Finder window

Firewall:

usage: firewall [ status | enable | disable | list | add | remove | help ]

Examples:
   firewall status                # Show status
   firewall enable                # Enable firewall
   firewall disable               # Disable firewall
   firewall list                  # List applications handled by firewall
   firewall add /path/to/file     # Add app to firewall
   firewall remove /path/to/file  # Remove app from firewall

Flightmode:

usage:  flightmode [ on | off | help ]

Examples:
  flightmode on                      # turn flightmode on
  flightmode off                     # turn flightmode off

Gatekeeper:

usage: gatekeeper [ status | list | ls | enable | disable | create | help ]

Examples:
  gatekeeper status                               # gatekeeper status
  gatekeeper list                                 # list rules

  gatekeeper enable                               # enable gatekeeper
  gatekeeper disable                              # disable gatekeeper

  gatekeeper enable MYRULE                        # enable rule
  gatekeeper disable MYRULE                       # disable rule

  gatekeeper create  RULENAME /path/to/program    #  Create a rule for the application

Group:

usage: group [ list | ls | info | adduser | removeuser | ismember | help ]

Examples:
  group list                          # get list of groups
  group info mygroup                  # display group information

  group adduser myuser mygroup        # add an user to a specific group
  group removeuser myuser mygroup     # remove an user from a specific group

  group ismember myuser mygroup       # show if the user is a member of a specific group

Hostname:

usage: hostname [ help ]

Examples:
  hostname                # get the current hostname information (computername, hostname, localhostname and netbiosname)
  hostname newhostname    # set a new hostname (computername, hostname, localhostname, netbiosname)

  hostname help           # only shows this help

Info:

usage: info [ help ]

Examples:
  info        #  print macOS operating system version information

Itunes:

usage: itunes [ status | play | pause | next | prev | mute | unmute | vol up | vol down | vol #| stop | quit | help ]

Examples:
  itunes status       # Show status
  itunes play         # Play track
  itunes pause        # Pause track
  itunes next         # Play next track
  itunes prev         # Play previous track
  itunes mute         # Mute iTunes
  itunes unmute       # Unmute iTunes
  itunes vol up       # Volume Up
  itunes vol down     # Volume Down
  itunes vol #        # Set volume level
  itunes stop         # Stop track
  itunes quit         # Quit iTunes

Lock:

usage:  lock [ help ]

Examples:
  lock      # lock session

Ntp:

usage: ntp [ status | enable | disable | set | help ]

Examples:
  ntp status                          # status of the network time service
  ntp enable                          # enable clock to use network time
  ntp disable                         # disable clock to use network time
  ntp set timehost1.net.sap.corp      # set network time server

Printer:

usage: printer [ settings | name | queue | drivers | web | help ]

Examples:
  printer settings    # Printer settings
  printer name        # Display printer names on system
  printer queue       # Display items in printer queue on system
  printer drivers     # Display all printer drivers
  printer web         # Enable and show web interface

Network:

usage:  network [ ls | list | location | help ]

Examples:
  network ls                          # list network interfaces
  network location                    # get current location
  network location ls                 # list locations
  network location create XYZ         # create a location
  network location delete XYZ         # delete a location
  network location switch XYZ         # switch location

Nosleep:

usage: nosleep [ until | help ]

Examples:
  nosleep until 3600            # no sleep until 3600 seconds
  nosleep until my_script.sh    # no sleep until the script ends

  nosleep until pid 64377       # no sleep until the process id ends

Notification:

usage: notification [ showcenter | help  ]

Examples:
  notification showcenter      # get the current status
  notification showcenter YES  # enable the notification center
  notification showcenter NO   # disable the notification center

Restart:

usage:  restart [ -f | --force | help ]

Examples:
  restart     # restart computer (needs confirmation)
  restart -f  # restart computer (without confirmation)

Safeboot:

usage: safeboot [ status | enable | disable | help ]

Examples:
  safeboot status     # get the boot args
  safeboot enable     # enable safe boot
  safeboot disable    # disable safeboot

Screensaver:

usage: screensaver [ status | askforpassword | help ]

Examples:
  screensaver                         # launch screensaver

  screensaver status                  #  get the current status
  screensaver askforpassword          #  get password requirement to unlock
  screensaver askforpassword YES      #  enable password requirement to unlock
  screensaver askforpassword NO       #  disable password requirement to unlock

Service:

usage: service [ --status-all | --list |  --ls | start | stop | load | unload | help ]

Examples:
  service --status-all                        # list all services

  service --list                              # list all services
  service --ls                                # list all services
  service --ls com.apple.sessionlogoutd       # show information about a specific service

  service start com.apple.sessionlogoutd      # start a service
  service stop com.apple.sessionlogoutd       # stop a service

  service load com.apple.sessionlogoutd       # load a service
  service unload com.apple.sessionlogoutd     # unload a service

Shutdown:

usage:   shutdown [-f | --force | help ]

Examples:
  shutdown     # shutdown computer (needs confirmation)
  shutdown -f  # shutdown computer (without confirmation)

Sleep:

usage: sleep [ help ]

Examples:
  sleep       #  put the mac to sleep

Timezone:

usage: timezone [ list | ls | set | help ]

Examples:
  timezone                    # get current timezone
  timezone ls                 # list available timezones
  timezone set Europe/Berlin  # set timezone

Trash:

usage: trash [ status | clean | help ]

Examples:
  trash status    # get trash info
  trash clean     # clean trash

Update

usage: update [ list | install | help ]

Examples:
  update list                                                 # list available updates
  update install all                                          # install all the available updates
  update install iTunesX-12.4.1 RAWCameraUpdate6.20-6.20      # install specific updates

User

usage: user [ list | ls | info | create | delete | help ]

Examples:
  user ls                # list users
  user info demouser     # display user information

  user create            # create a user, it will ask you the below information
                                Username:
                                Full name:
                                Shell [/bin/bash]:
                                Password:

  user delete demouser   # delete user

Volume:

usage:  volume [ level(0-100) | change(-n|+n) | up | down | mute | unmute | ismute ]

Examples:
  volume 70     # set the volume to 70 %
  volume +5     # increase the volume by 5 (up to 100)
  volume -10    # decrease the volume by 5 (down to 0)
  volume up     # increase the volume by 6.25
  volume down   # decrease the volume by 6.25
  volume        # get the volume level
  volume mute   # set mute
  volume unmute # unset mute
  volume ismute # check the volume status

VPN:

usage:  vpn [ ls | list | start | stop | status | help ]

Examples:
  vpn ls                              # list VPN connections

  vpn start                           # interactive mode
  vpn start VPN                       # start vpn connection named VPN
  vpn start VPN USER                  # start a vpn connection with a given user
  vpn start VPN USER PASS             # start a vpn connection with a given user and password
  vpn start VPN USER PASS SECRET      # start a vpn connection with a given user, password, and secret

  vpn stop VPN                        # stop vpn connection named VPN
  vpn status VPN                      # status vpn connection named VPN

Wallpaper:

usage: wallpaper [ /path/to/file.jpg | help ]

Examples:
  wallpaper ./wallpapers/tree.jpg  # set wallpaper

Wifi:

usage:  wifi [ scan | off | on | connect | help ]

Examples:
  wifi status                  # wifi status
  wifi scan                    # scan wifi
  wifi showpassword [ESSID]    # show wifi network password (default: current)
  wifi ls                      # list known wifi networks
  wifi list                    # list known wifi networks
  wifi forget ESSID            # forget a wifi network
  wifi history                 # wifi connection history
  wifi off                     # turn off your wifi
  wifi on                      # turn on your wifi
  wifi connect ESSID PASSWORD  # join a wifi network
  wifi connect ESSID           # join a wifi network (prompt for password)

Download:

usage:  download [ url ]

Examples:
  open "http://google.com/file.zip"    # downloads a file

Notification Center:

usage:  notificationcenter [ title | message ]

Examples:
  notificationcenter "hello" "world" # shows a notification on the notification center

Open:

usage:  open [ file | application | url ]

Examples:
  open "http://google.com"                   # opens a website
  open /Volumes/Archive/Documents/file.txt   # opens a file
  open /Applications/Messages.app            # opens an application

Say:

usage:  say [ message ]

Examples:
  say "hello"    # says hello

Making your own Applet

For the trigger of your Applet, you can choose almost any IFTTT service since the triggers are independent to macOS IFTTT Control, For this tutorial we will use the service "Button Widget" as trigger.

For this example, we will create a button that turns off the Bluetooth on our Mac.

1. Selecting the Trigger

As I said before, you can choose almost any service from IFTTT, The only condition is that the service that will be used as a trigger has a unique ingredient, such as the date on which it was triggered. For this example I will use the Button Widget as a trigger.

Button Widget

2. Selecting the Action

For the action, the "Dropbox" service must always be used. Once the Dropbox service has been selected, the "Append to a text file" option must be selected.

Dropbox Options

3. Building the Action Command

Now is the time to build the command that will run on our Mac, in this case we want to turn off the Bluetooth. For that we must fill the following data inside the applet:

  • File name: Your Mac Hash
  • Content: The command to execute
  • Dropbox folder path: macOSIFTTTControl/

The commands should be written in the following format: unique id|command parameters, You can use the trigger date as unique id. In this case our command will be {{OccurredAt}}|bluetooth off

Dropbox Settings

4. Done

And that's it! Your applet is ready, now you can try it or port it to IFTTT Platform to share it with more users.

Applet Preview

Publishing Applets

If you want to create an applet in order to publish it later, you must follow all the steps above but using the IFTTT Platform interface which is intended for developers rather than the end user interface.

If the purpose of the applet is to be published in the Marketplace we recommend you to read this article.

You can’t perform that action at this time.