How To Remotely Control Your Mac Using Simple AppleScripts
MUO
How To Remotely Control Your Mac Using Simple AppleScripts
If you're lucky to have two or more Macs in your home or office, you no doubt find occasions where you would like to remote control a Mac either from another room or from another part of the country. You probably know that you can use the Shared feature to remotely control another Mac on the same network. But by creating some simple AppleScript commands you can control a remote Mac much faster, alleviating the need to open the Shared screen feature. If you have never worked with AppleScript before, don't fret. The following Mac remote control scripts are very short and easy to use. Settings For Remote Control
In order to remotely control a Mac, say your desktop machine, you must first set it up for commands to be sent to it. To do this, launch System Preferences > Sharing on the Mac you want to control. Click the box next to Remote Apple Events, and set user restrictions if you need to. Next, you will need the IP address. In System Preferences, switch to Network and locate your machine's IP address. It should be something like, 192.168.2.3.4.. Copy that address to proceed to the next step. You can also use the machine's Bonjour name which can be found at the top of the Sharing pane in System Preferences. Its address will be spelled similar to this one: "smith-nancy-computer.local." Create A Script Command
Now, on another Mac, say your laptop, launch the AppleScript Editor, which can be found in Applications Folder > Utilities Folder. Our first command will be one that puts the remote Mac to sleep. In AppleScript, go to File > New. Copy and paste the following simple script in the editor: tell application "Finder" of machine "eppc://192.163.1.2.3"sleep end tell Replace the sample IP address with the address of the Mac you're going to send the command to. Be sure the address comes after "eppc://. Now click the Compile icon. If you don't get an error message, you should be good to go. Now make sure the remote is awake and running. Click the Run button in AppleScript. You will probably be asked for authentication. Type the username and password of the Mac you're sending the command to. If it works, then you have successfully sent your first remote command to another Mac. Saving Your Scripts
There are a couple of ways you can save and access your scripts. You can save them to the Scripts Menu that can be put into the menu bar of your desktop. It looks like this: If it is not there, go to the AppleScript Editor, open its Preferences and click the box, "Show Script menu in menu bar" in the General Pane. If that doesn't bring it up, look for the AppleScript's folder in the Applications folder. Inside that folder, find and click on "Install Script Menu." Save your script in your Home Library > Scripts folder. It then should show up in you Scripts Menu. From there, you can run the script whenever you need it without having the AppleScript Editor open. If you think you're going to run the script on a regular basis, you can save it as an application and put it in your Dock. Other Command Scripts
Here are a few other commands that you might want to send to your Mac. Start iTunes
tell application "iTunes" of machine "eppc://IP Address"playend tell Stop iTunes
tell application "iTunes" of machine "eppc://IP Address"stop end tell Increase Volume
tell application "Finder" of machine "eppc://IP Address"set volume 7 -- Call this one "Full Volume" end tell Open The Safari Browser
tell application "Safari" of machine "eppc://IP Address"activate end tell Close The Safari Browser
tell application "Safari" of machine "eppc://IP Address"quit end tell Let me know if this tutorial works out for you. If you know of other AppleScript commands that our readers might find useful, please share them here. For some more AppleScript automation ideas, check out this , and if you looking for Mac automation tips, download my free .