You're on the road, racing to your morning meeting, and then it dawns on you that in your haste out the door, you'd left your computer turned on. Normally, you'd kick yourself all the way to the office for the electricity you're going to waste leaving your computer idling all day at home, but not today. Today, you pull over to the side of the road, send a quick text stating "shutdown #mycomputer", and then head off again to work. Job done.
This scenario is possible - or one where you need to kick off a virus scan, initiate a website backup, ping a server and email the results, and a whole list of other jobs right from your home computer, while you're not even at home. Not only is it possible, but it's actually pretty easy to do by combining together Dropbox and IFTTT, and writing a little bit of simple Windows Script. If you're new to Dropbox, check out our full guide on it.
Have no fear, I'll show you how to set up the system, how to write your first Windows Script File (WSF) command that you can trigger using a text message, and then I'll send you off with a final list of other scripts you could launch on your home PC via a simple text message. Sound like fun? Let's roll.
Set Up Dropbox and IFTTT
Here's how this system works. First, you send an SMS command to IFTTT, which takes your command and translates it into a text file that gets placed into a special folder on your Dropbox account. Meanwhile, you've configured your computer to regularly monitor that directory and watch for the text files. When it sees a new text file shows up, your computer will follow whatever command is identified by the name of the file.
The first step of this is to create a special folder in your Dropbox account just for the purpose of allowing IFTTT to place these "command" files.
Once you've done this, go into your IFTTT account and create a new recipe. Choose SMS as the trigger channel, and then "Send IFTTT an SMS tagged" as the trigger.
This lets you define a special tagged SMS that will trigger IFTTT to take action. You can call the special tag anything you want. In my case, I called it #mycomputer.
IFTTT provides you with a special phone number to send your SMS commands to. Make note of this number and save it to your phone contacts list. This is the number you'll use to command your computer remotely.
Next, still in IFTTT, you'll need to select the "This" action. Choose the Dropbox Action channel, and then choose the "Create a text file" action.
Set it up to use the special Dropbox folder you've created, and you can leave the rest of the fields as default. You'll notice that the File name of the file placed into the Dropbox folder is the message that you type into your phone. So, if you want IFTTT to place a text file called shutdown.txt in your Dropbox folder, then you'll text the phrase "shutdown.exe #mycomputer" - that's it!
Now IFTTT is configured to receive your SMS and insert the text file that you've told it to, directly into the special remote control folder you've set up in Dropbox just for this purpose.
Now that this is done, it's time to set up your computer to monitor that special folder, and respond whenever any new text files arrive.
Setting Up Your Computer
The first thing you'll want to do is install Dropbox on your computer if you haven't already. Just go to your Dropbox account, click on your profile name dropdown and click on the "Install Link".
Once you're done with that, you'll need to configure the Windows Script that will regularly monitor your Dropbox folder and look for new text files to appear.
<job>
<script language="VBScript">
Dim file1
Dim objShell
Dim strComputer
Dim strShutdown
Set file1 = CreateObject("Scripting.FileSystemObject")
If (file1.FileExists("C:\Users\Owner\Dropbox\Remote_Control\shutdown.txt")) Then
file1.DeleteFile "C:\Users\Owner\Dropbox\Remote_Control\shutdown.txt"
strComputer = "Owner-PC"
strShutdown = "shutdown.exe -s -t 0 -f -m \\" & strComputer
set objShell = CreateObject("WScript.Shell")
objShell.Run strShutdown
end if
Wscript.Quit
</script>
</job>
All you need to do is edit this file and add a new "If" statement for every different text file and command that you want to add to your new SMS-Command system. In the script above, the "FileExists" command checks whether the "shutdown.txt" is present in the Dropbox path. If it is there, it immediately deletes the file, and then runs the Shutdown command.
Save this anywhere on your PC that you like, and then set up a scheduled task to run it at some frequency. In my case, I run it every hour to check the Dropbox folder for new SMS commands.
Just add the path of the monitoring script under the "Actions" tab in your scheduled task.
Don't forget to select "Wake the computer to run this task", so that the task will still run when you aren't around the computer.
The system is now good to go.
Issuing Your Computer Text Messages
Running a quick test, I sent an SMS of "shutdown #mycomputer" to the IFTTT phone number, and within less than 20 seconds, I received the file in my Dropbox account.
Another section of script that I added was the one for pinging a website and emailing the results code that you can find at my article on 3 awesome Windows scripts. Just putting this inside an If statement in the same WSF file described above - looking for "pingsite.txt" in the Dropbox folder will trigger that section of code.
That script can be triggered simply by texting "pingsite #mycomputer". IFTTT puts "pingsite.txt" into the Dropbox folder, the hourly script spots it, and runs that section of code! It's a solution that will work for any WSF script that you can think up - just add it to the file under a new section looking for a text file under a different name in the Dropbox folder. The possibilities are unlimited.
You text, your computer responds.
Have you ever accomplished SMS-to-computer automation like this? If so, what approach did you take? Do you like this approach? Share your own tips and feedback in the comments section below!
Image Credit: Hand With Cellphone via FreeDigitalPhotos.net