This plugin allows you to perform actions on any Mac in your network, whether it is the Indigo server or not. What you can do is only limited to what Applescript can do on the given machine.
At its core this plugin is a Python program that executes Applescript commands on your desired machine. While this is easily accomplished using Indigo's scripting, I wanted to be able to take it a step further by having an On/Off state associated with the command.
For example (and why I built this in the first place): I have Plex running on one of my Macs in the house (not the Indigo server) and wanted to be able to turn the Plex Server on and off at will. I accomplished this easily with some Indigo scripting but it was just firing into the blind. What this app does is allow me to assign an "On" command (start Plex server), and "Off" command (stop Plex server) and a "Polling" option to see if Plex server is running or not and dynamically turn my "device" on or off as a result.
Like most of my plugins, this was centered around it's ability to be useful in a control page, so a single button can turn commands On and Off via toggle and display their On/Off state as a change in the button graphic.
This concept can be expanded to any program or any script. The only thing required is that you have enabled remote access in your Mac's sharing and know the IP address, username and password.
Download and Installation
The first thing you need to do is to enable "Remote Login" on any Mac that you want to control with this plugin. This allows Applescript to execute remote commands:
Install the plugin according to the Indigo documentation.
Once installed you create a device for each command set you want to manage and set the options.
Download Plugin (Indigo File Library)
Release Notes
- May 22, 2016 (1.0.0):
- Initial release
Plans For Future Releases
- Only execute app-based commands if a user is logged in
- Add additional polling options
- Remotely shutdown or restart a computer
Configuration and Use
The options are pretty straightforward and relatively dynamic. Keep in mind that you will start off in Indigo with a fairly small configuration window but as you select options you may have to scroll down in the window to see them.
When you first add the device you get a basic configuration window with some sample data:
Selecting "Run actions on Indigo server" means you will not need to connect to a remote computer (nor does the Indigo server need to have Remote Login enabled in sharing), otherwise you will want this unchecked and supply the IP address and credentials of the computer you are commanding.
If you enable polling you will see the following:
There is currently only one method and it's selected as "Application is Running" by default. The proper application name should reflect what the icon says in your Applications folder, with no .app extension. Polling interval is how many seconds Indigo will check to see if that app is running or not (if it is the device is set to On, if not then it's set to Off). The final polling method parameter is when you want to poll that device - you can have it Always poll 24/7, only poll when the device is On or only poll when it's Off. While the plugin is not memory or time hungry, there is no need to constantly poll something if you only want to do so when it's on or off. Polling is optional, if you don't provide it then the device will only turn On and Off if you do so manually.
Both the On and Off actions configure the same way and neither is required. This is to say that you can define only an On or only an Off if you choose, but you are not required to have both. This lets you just have a static remote command that you execute at will rather than worrying about on/off states. The options are:
The options are fairly self explanatory. Depending on which option you choose will add additional fields in the configuration for you to fill in:
- Run Application: Provide the proper name for the app to run and the app must reside in your Applications folder. This can also be a compiled Applescript program (see advanced below)
- Quit Application: Same field as Run Application
- Display a Message: Currently not available, I'm working on a few bugs on this
- Sleep: Put the computer to sleep, no additional options but I may add a timer to this later
- Start Screensaver: Start the screensaver, no additional options
- iTunes: Another menu of possible iTunes commands will appear in the configuration, the only one of note is the Playlist, in which case you will need to provide the exact name of the playlist to play (useful if you use Airfoil and want to automate that a bit more)
Advanced
There are some things that either don't work well with normal Applescript commands or don't like to be done remotely (i.e., stopping Plex Server). In these cases you simply write the Applescript command(s) that do what you want to do, save that Applescript as a compiled application in your Applications folder and tell the plugin to execute that compiled Applescript.
For example, I wanted to stop my Plex server so I wrote and compiled the following script on that Mac called "Stop Plex.app" and saved it to my Applications folder on the computer with Plex Media Server:
- Code: Select all
tell application "Plex Media Server" to quit
Limitations
The plugin is a work in progress so not every possible outcome is accounted for. For example I have not yet added a check to see if there is a person logged into the Mac you want to command (although it is planned), so you will need to make sure the Mac is logged in before you try to command it.
Currently the polling has only one method, to see if an application is running. While this may be limiting, you can create a compiled Applescript on the destination Mac that will activate or quit depending on your own circumstances, check for THAT app's running status and use that. I'm sure there are dozens of ways I can poll for a particular situation, so tell me what you would like to poll and I'll see if I can build it in.
I threw in some iTunes commands just because I could (and I find them useful in my own environment) so there wouldn't be just a single task this plugin can do. If you have ideas of things you would like the plugin to do natively let me know and I'll see about expanding the functionality of the plugin to incorporate that.
Examples of Use
- Example: When the office light is turned off start the password protected screensaver on the computer
- Computer: Turn on Remote Login (see instructions above) in Preferences->Sharing on the office computer
- Device: Create Mac Command device where the "On Action" is "Start Screensaver" and the IP address, username and password are set for the office computer
- Trigger: When office light becomes Off turn On Mac Command device