Remote Action: Major Update! (Start Applications Remotely with Dropbox and Autohotkey)




Update [June 1st, 12 pm Brazil time (GMT-3)]: Just wrote a script that will create your dummy.ahk script hassle-free and save it on My Dropbox folder, alongside the remoteAction.ahk script. Download it here. Leave this running on your local PC (place it on your startup folder to make things real simple) and whenever you want to create an action to be performed remotely, just press Ctrl+Win+A and type your Autohotkey command on the displayed window. Hit OK and your dummy.ahk script will have been created with that content. A couple of things to remember: Before using it, you must check the makeDummy.ahk script to see if your My Dropbox folder path is correct. If not, edit and overwrite it. Another thing is replacing the custom action list with your own, never forgetting to write it all in one line and indicating new lines with `,`; (exactly as typed). If you are curious and wish to know what the script looks like before you download it, here it is:








^#a::
Gui, 22:Add, Text,, Type remote action to send.`nAll actions must be compatible with AHK scripting.
Gui, 22:Add, Edit, r22 W500 vMyEdit22remote, `;Run, notepad.exe`n`;Run, http://twitter.com/brasildeluna`n`;MsgBox, Call me right away!
Gui, 22:Add, Button, default, OK
Gui, 22:Show,, Remote action
return
22GuiEscape:
22GuiClose:
   Gui, Destroy
return
22ButtonOK:
   GuiControlGet, MyEdit22remote
Gui, Destroy
if ErrorLevel
    Sleep, 0
    FileAppend, %MyEdit22remote%, C:\Dropbox\My Dropbox\AHK\dummy.ahk ;
Return













Just last week I posted a simple solution I had come up with for launching apps remotely using only Dropbox and Autohotkey. A few days later, my idea was posted by Whitson Gordon at Lifehacker.com, probably the best tech website ever, and definitely my all time favorite.

With over 12.000 page views and hundreds of tweets, commenters gathered around this very simple idea and made it bigger, better and awesomer!

And so, what started out as a simple script that reloaded itself every 5 minutes and had to be edited a couple of times to work, now looks like this (download it here):

FormatTime, CurrentDateTime,, yyyy.MM.dd.HH.mm.ss 
IfExist, dummy.ahk
{
Run, dummy.ahk
Sleep, 1000
FileMove, dummy.ahk, remoteAction_ran/%CurrentDateTime%_dummy.ahk
}
Sleep, 300000
Reload

What it does now is much more than just reload itself. In fact, this script doesn't even have to be touched anymore, like it had to in my original post.

All you gotta do now is place this script in My Dropbox folder and create a shortcut to it on your remote computer's Startup folder. Whenever you want to send any Autohotkey action to your remote computer, just create a script called "dummy.ahk" (without the quotes, of course) and save it too on My Dropbox folder, alongside the script above.

What's gonna happen is that the original script will keep reloading itself every five minutes, and when it does, it'll check to see if there's a script called "dummy.ahk". If there is none, nothing will happen. However, if it is found, the dummy script will be run and moved to a sub-folder called "remoteAction_ran" (you may have to create this sub-folder yourself). Moreover, it will be renamed to include the exact date and time the script ran. 

This is a great way to not only send actions to your remote PC, but also to keep track of what's been done and when.

Here are a few examples of what "dummy.ahk" scripts could look like:

MsgBox, Mom, call me right away, I forgot our home number again!
Return

This will send an alert to whomever is using your remote PC at the moment.

Run, auto.bat
Return

This will run a batch file lying in My Dropbox folder.

Shutdown, 1 
Return

This will remotely shutdown your computer

Run, C:\Program Files\LogMeIn\x86\LogMeIn.exe
Return

This will run an application remotely. Is this example, I'm launching LogMeIn.

The possibilities can really take you as far as your mind can go.

A "Thank you very much" to Whitson Gordon at Lifehacker.com, to all the great commenters out there who made great advances to my original script and to everyone who enjoyed this solution I came up with last week. Also, to everyone that tweeted my blog post and the Lifehacker post. I am very grateful to have been featured on such a magnificent website. I truly thank you all.

- César