How to Issue a Command to Your Computer With a Text Message

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.

txt pc control1   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control2   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control3   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control4   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control5   How to Issue a Command to Your Computer With a Text Message

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!

txt pc control6   How to Issue a Command to Your Computer With a Text Message

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”.

txt pc control7   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control8   How to Issue a Command to Your Computer With a Text Message

Just add the path of the monitoring script under the “Actions” tab in your scheduled task.

txt pc control9   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control10   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control11   How to Issue a Command to Your Computer With a Text Message

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.

txt pc control12   How to Issue a Command to Your Computer With a Text Message

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

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

43 Comments -

Yashodhan B

Hi there, first of all thanks for keeping the tone of the article geeky as well as informative.

I tried as you told but the problem is that IFTTT SMS channel needs to be verified for your cell numbers, which for Indian numbers , can’t happen. Maybe Indian mobile providers are not allowed or I don’t know why but I wasn’t able to receive any kind of verification text on my cell phone when I tried to activate the SMS channel.

I even tried prefixing 00 as well as 91 before my number.
I had a postpaid number so I tried with prepaid one too but to no avail.

John P

You might try pinger, you might be able to get a US number that way, and use it for your ifttt number. I’ve never tried it, but it seems like it might have a possibility of working.

Duckeenie

I use a hacked NowTV box in my bedroom that I often use to stream from a Plex server running on my PC. I have been making do with a Windows task that turns my PC off at a select time as long as it isn’t been used. Your solution is far more elegant, I will use this to try to learn a little IFTTT.

Vala

Should I copy paste those lines into notepad and alter the path and pc owner name AND then change the extension to wsf? If yes I did that and after running the task I get this error:
http://i.imgur.com/aSg5amZ.png?1

Ryan Dube

I can repeat this error and have the following fix: You need to make sure not only to paste it into Notepad but actually retype the quotes …”

Otherwise it may keep the smart curly if you’ve copied it right out of here. I noticed when I pasted it into notepad that it kept the wrong style quotes, oddly enough. But when I deleted it and re-typed the quotes it worked fine. Give it a try.

dragonduder

Change all the quotation marks to the quotations on your keyboard. That’s what fixed mine.

Suleiman Orotta

Hey Ryan, thanks a lot for this, it was fun to learn new thing today. I followed your instructions all the way and lost my way when i reached at ” Save this anywhere on your PC that you like, and then set up a scheduled task to run it at some frequency” . What is “it” and how do u save it and run the schedule . This is what i did. I saved the file as .vbs on notepad. I sent txt to ifff and i saw the pop up on dropbox. Now, which one do I have to schedule, the saved .vbs file or the dropbox. PS: I never did programming on Windows scripts before; all my guess was based on my C++ programing stuff. I can’t wait to shutoff my pc with sms :) Thanks again for sharing this.

dragonduder

Save the code above as DBScript.wsf. Save it somewhere like your My Documents folder. This file is what you will schedule.

Also, before you finish saving the code above, change “owner” to the name of your pc (mine is Ryan, for instance) and change the quotation marks to the quotation marks on your keyboard. I would get an error message when I used the quotes in the code above (format error? idk)

Excellent post! Works perfect when I fixed it up a little bit. I just wish the Task Schedule could automate sooner than once an hour.

TechnoAngina

dragon nice troubleshooting! The keyboard and HTML codes for the quotation marks are actually different codes in computer language.

Ben

Thanks for this. I had it saved as a .txt and it was running and opening notepad. That should have been clearer. Thanks!

Suleiman Orotta

ifff = ifttt sorry about that, i just knew about it today , thanks to Ryan for that.

Xavier

I had an error on the windows script:
Script: C:Users****DesktopmonitorCommands.wsf
Line: 2
Char: 10
Error: The value for this attribute is not valid : language
Code: 80040049
Source: Windows Script Host

Any ideas?

Suleiman

i got the same error msg too. Where is Rayn, he should get involved in this discussion :)

TechnoAngina

There’s an error on your system. It can’t call a specific DLL. You’d have to be able to figure out which registry key is invalid. Unfortunately it’s a really generic error code, so more than that would be hard for me to give.

Ryan Dube

I can repeat this error and have the following fix: You need to make sure not only to paste it into Notepad but actually retype the quotes …”

Otherwise it may keep the smart curly if you’ve copied it right out of here. I noticed when I pasted it into notepad that it kept the wrong style quotes, oddly enough. But when I deleted it and re-typed the quotes it worked fine. Give it a try.

dragonduder

Change the quotation marks to the quotes on your keyboard, that fixed mine!

Suleiman

I did change the quotations. Assume my computer name is GTA5 and this is what i did. It is not working for me somehow:

Dim file1
Dim objShell
Dim strComputer
Dim strShutdown
Set file1 = CreateObject(“Scripting.FileSystemObject”)
If (file1.FileExists(“C:UsersGTA5DropboxRemote_Controlshutdown.txt”))

Then
file1.DeleteFile “C:UsersGTA5DropboxRemote_Controlshutdown.txt”
strComputer = “GTA5-PC”
strShutdown = “shutdown.exe -s -t 0 -f -m \” & strComputer
set objShell = CreateObject(“WScript.Shell”)
objShell.Run strShutdown
end if
Wscript.Quit

I am suspecting the error at : strComputer = “GTA5-PC”, should it be strComputer = “GTA5″ .

One more thing, i sent a txt to ifttt as “shutdown #mycomputer” , it is case sensitive?

Thank you for your help , i am just curious to see it working for me, and i am learning in the process .

dragonduder

I think

strShutdown = “shutdown.exe -s -t 0 -f -m ” & strComputer

should be

strShutdown = “shutdown.exe -s -t 0 -f -m \” & strComputer

As in two slashes.

If that still doesn’t work try changing

If (file1.FileExists(“C:UsersGTA5DropboxRemote_Controlshutdown.txt”))

Then

to…

If (file1.FileExists(“C:UsersGTA5DropboxRemote_Controlshutdown.txt”)) Then

I don’t think it matters that the Then is on the same line, but I guess it’s worth trying.

Andrei

In my country most of the SMS-related services are not available but I’ve used TweetMyPC to accomplish a similar thing. Not sure if it still works with the current Twitter API. Love this stuff by the way, do more!

dragonduder

Very cool, received an error message though. Any assistance? Upon running the script (clicking on it or running the task) I receive the following message.

—————————
Windows Script Host
—————————
Script: C:UsersRyan2DropboxDBScript.wsf
Line: 2
Char: 10
Error: The value for the attribute is not valid : language
Code: 80040049
Source: Windows Script Host

—————————
OK
—————————

Is there an error in the coding? I copied it directly from above. Thanks!

TechnoAngina

Are you an admin on your machine? Someone else got the same issue above and from the research I’ve done on it, it appears to be an incorrect registry setting of some sort.

Ryan Dube

Please see the solution posted above (worked for me) – WSF is sensitive to the use of curly-quotes and you will receive this language error because the “script language=”VBScript”” part of the program isn’t being recognized.

dragonduder

I fixed it by changing the quotation marks to the quotes on my keyboard. I believe when the author posted it above, the quotations were from Word or something and don’t translate well to the notepad. idk, but changing the quotes worked! I use this to remote shutdown and reboot my pc now, very cool. Someone list more cool ideas for WSF scripting!

hamza

remove the 2nd line

John Doe

Why go through this long process, when there are apps out there such as VNC or Unified Remote, which controls both PC shutdown options but controls it from anywhere in the globe. Just Saying, make life smarter, not harder.

Ryan Dube

Because doing it via Text Message is just…really cool. :-)

And it could have implications for larger, even cooler applications – if someone is clever enough to work out other uses for this.

Ben

Can you give some more examples of how to write script for common tasks? Like maybe running a virus scan, or checking for updates, etc. I liked this a lot, but I feel like I set everything up and now I don’t know what to do with it.

TechnoAngina

Calling program is actually a pretty basic operation. You can look up something as simple as Windows Batch scripting. Googling will bring up some pretty decent tools. You’ll probably also want to look up if applications have a CLI or command line interface. If you’re looking to get really powerful I’d recommend jumping into some basic VBscript or Powershell. You can do a lot with your computer if you know what you want to do with it. Unfortunately I think they would have to run a series to be able to do what you’re asking.

dragonduder

I think I got the hang of it. Basically anything you can do in the command line, you can add to the wsf script. For instance, I added this to the script and it should trigger a quick scan with Microsoft Security Essentials if it finds a “scan.txt” file in my Dropbox folder:

If (file1.FileExists(“C:UsersNAMEDropboxRemote_Controlscan.txt”)) Then
file1.DeleteFile “C:UsersNAMEDropboxRemote_Controlscan.txt”
strComputer = “NAME-PC”

strScan = “”C:Program FilesMicrosoft Security ClientMpCmdRun” -Scan -ScanType 1″ & strComputer
set objShell = CreateObject(“WScript.Shell”)
objShell.Run strScan
end if

dragonduder

Damn, on second thought I’m getting an error trying that code. Anyone got a fix?

R Hopgood

Can this be done with other cloud services??

DT

Hey Ryan, just curious, in the screenshots showing the task scheduler, what are those two extra buttons in the upper right of the dialog window? Thanks, David

Vala Z

@Ryan Dube
Thanx it worked. Is there any way to hibernate the PC instead? I want to learn more about Windows Scripting. I have absolutely no knowledge of it. Any recommendations?

dragonduder

I think the command line code for hibernate is “shutdown -h”, try replacing the shutdown in the code above with that and see if it works. I’ll try it and report back in a few

dragonmouth

It may be kewl but how secure is this procedure? If you can command your PC with a text message, can’t other people?

dragonduder

Only if they have access to your dropbox or IFTTT.

dragonmouth

As if dropbox and IFTTT cannot be hacked.

dragonduder

Then the OBVIOUS question isn’t “how secure is this procedure”, but “how secure are my dropbox and IFTTT accounts”.

dragonduder

Using an earlier MUO article, http://www.makeuseof.com/tag/xx-ways-clean-computer-automated-script/

Add this to scan your PC with MRT when you text “scan”:

If (file1.FileExists(“C:UsersPCDropboxRemote_Controlscan.txt”)) Then
file1.DeleteFile “C:UsersPCDropboxRemote_Controlscan.txt”

strScan = “C:WindowsSystem32mrt.exe /Q /F:Y”
set objShell = CreateObject(“WScript.Shell”)
objShell.Run strScan
end if

Anonymous

Regarding security:
Even if they had access to your dropbox and IFTTT, wouldn’t they also have to store a script on your machine?

Anat very knowledgeable

Regarding security:
Even if they had access to your dropbox and IFTTT, wouldn’t they also have to store a script on your machine?

Will

how to set up in ifttt it has changed asking for recipe

Will

How to set up Mobile Phone not working