Run AppleScripts on a Mac using Remote.app
Oct 12, '10 07:30:00AM
Contributed by: Anonymous
While the iTunes Remote for iPhone app from Apple is very cool many of us are still waiting for a script editor to make it's appearance on iOS. This AppleScript will allow you to run specific pre-written scripts on your Mac from your iPhone, using iTunes as an intermediary.
First create a stay open application from this script in the AppleScript Editor and add it to your Login Items in the Accounts pref panel:
on idle
tell application "iTunes"
try
copy comment of current track to tehscript
copy name of current playlist to tehlist
if tehlist = "scripts" then
if player state is playing then
pause
do shell script "osascript -e '" & tehscript & "'"
end if
end if
end try
end tell
return 5
end idle
Then create a new playlist in iTunes called Scripts. Be sure to share that playlist in iTunes. Now make a short (~8 seconds no shorter then 5) sound file, using GarageBand, Audacity, or your favorite sound editing application.
To add a script, modify the name of the sound file in Finder (so iTunes will add it a second time) and drag it into iTunes. Then type your script into TextEdit and copy it into the comments of your sound file in iTunes. You can then use the Remote app from your iOS device to connect to the shared music library on your Mac and select the track in the Scripts playlist.
Note there is no way (that I know of) to send anything to the scripts from your iPhone (other than simply executing them).
[crarko adds: I tested this, and it works as described. I uploaded the script and a sample sound file provided by the author here. This seems more of a curiosity to me but I'm sure some enterprising scripter will make use of it.]
Comments (12)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100919164421644