MusicMaster Scheduling
Your viewing experience of the MusicMaster website, as well as the web as a whole, would be much improved if you upgraded your browser.

MusicMaster Blog

Using IFTTT to Automate Tasks in MusicMaster posted on September 2nd, 2015

By Drew Bennett

These days it’s tough to get everything done. We always seem to be saying things like, “I wish there were more hours in the day, “ or, “…if I could just clone myself!”

An online company has made an attempt to automate certain corners of your life to make those days seem a little easier. It’d called IFTTT. That stands for, “If This, Then That.”

IFTTT can help you automate anything. Maybe you like to turn on the house lights when you get home or maybe you’d like to start the slow cooker at home while you work in the office. IFTTT can help you do those kinds of things. Today, I’m going to show you how IFTTT can help you automate tasks in MusicMaster. It will be like having your own Music Director who performs tasks when you want them done but without all that salary and benefits mumbo jumbo.

Today, I’m going to show you how you can send a text message to yourself that tells your office computer to open MusicMaster and schedule the next days’ log.

You need several things to get it done.

  1. An account at IFTTT.
  2. A recipe at IFTTT that creates a file in Dropbox when you send a text message to yourself.
  3. A batch file that is used to run a Windows Script file from a Windows Scheduled Task.
  4. A Windows Script file that monitors the Dropbox folder for the text messaged file, deletes the file if it exists and runs another local batch file.
  5. A batch file to run a command definition file inside MusicMaster.
  6. A command file to automate a MusicMaster task like scheduling a day.

First, head to http://www.ifttt.com and create an account. Login, and activate the Dropbox Channel. Create a recipe where “THIS” expects a text message sent by you and “THAT” creates a file in Dropbox. I’ve included a screenshot to show you what that setup will look like. In the example below, I’ve chosen to create the file in a Dropbox folder called, Remote_Control.

ifttt1When this recipe is performed, IFTTT creates a file in your Dropbox folder called —.txt. Test this by texting your IFTTT number to make sure the file gets created in your Dropbox folder.

Next, let’s create a batch file we will use with a Windows Scheduled Task. The batch file will run every 5 minutes or so via scheduled task. This file runs the script file for us. Open Notepad and paste the following:

@Echo on
cscript IFTTTSCRIPT.wsf

Save this file and call it IFTTTSCRIPT.bat

We need to create a Windows Scheduled Task that runs this file at an interval of your choosing. Open Windows Scheduled Tasks and create a new task.

ifttt2

This scheduled task runs the IFTTTSCRIPT.bat file that handles the Windows Script file you’ll make next. Schedule this task so that it runs at a regular interval.

Now, it’s time to set up the Windows Script file that looks for the SMS file in Dropbox. To save you some time and heartache, I’ve pasted the file here. You’ll make changes to the sections highlighted in red.

<job>
<script language="VBScript">

Dim file1

Set file1 = CreateObject("Scripting.FileSystemObject")
If (file1.FileExists("C:\Users\Owner\Dropbox\Remote_Control\---.txt")) Then
file1.DeleteFile "C:\Users\Owner\Dropbox\Remote_Control\---.txt"

dim shell
set shell=createobject("wscript.shell")
shell.Run """C:\Program Files (x86)\MusicMaster\IFTTT.bat"""
set shell=nothing

end if

Wscript.Quit

</script>
</job>

In the Windows Script file above, make sure the Dropbox path is the correct path on your machine. In the path to IFTTT.bat, make sure this is the correct path on your machine as well. Paste this text with your changes to a Notepad file and save it as IFTTTSCRIPT.wsf.

The Windows Script file’s job is to monitor the Dropbox folder for the existence of “–.txt.” If it exists, the script file deletes it and runs a batch file that launches a command def, scheduling a day in your database. If the file does not exist, nothing happens.

Let’s write the batch file that we use to run the command def in MusicMaster. It looks like this:

MUSICMASTER.EXE SAMPLE.mmd /STARTUP=SAMPLE.DEF /AUTOEXIT

The database and command file are in bold. Change these values to reference your database filename and your command file. Save this file and call it IFTTT.bat.

It’s time to make the command file that performs the automated task in MusicMaster. Command files can be used to automate tasks in MusicMaster like scheduling a day, exporting a log or running a history report. In fact, I’ve written another article on command files and how to set them up. Check it out here and once you’ve built your own command file, use it in this project to automate tasks in MusicMaster.

That’s it. Now, when you send yourself a text message, the scheduled task launches the WSF file which monitors Dropbox for the txt file created when you send the text. If that condition is true, the batch file runs and MusicMaster schedules a day, or whatever the command def tells it to do.

In fact, the text message doesn’t have to be the trigger. It could trigger when you pull into your driveway, when you send an email or when you turn on a light! IFTTT allows you to use all sorts of conditions in a recipe. If you have questions about this project or any MusicMaster related question, please contact your assigned Music Scheduling Consultant and happy scheduling!