| Sign In/My Account | View Cart |
| Article: |
Build an iTunes Remote Control | |
| Subject: | I wrote this, And it doesn't work. | |
| Date: | 2005-03-20 10:52:35 | |
| From: | Cool6324 | |
|
tell application "iTunes" run end tell
|
||
Showing messages 1 through 5 of 5.
I wrote this, And it doesn't work. tell application "Terminal"
do shell script "sudo /Library/WebServer/CGI-Executables/iTunesRemoteControlDaemon.scr" password "xxxx" with administrator privileges
end tell
I wrote this, And it doesn't work.sudo chmod 777 /private/tmp/iTunesRemoteControl in terminal. That will do the trick. I have also added some commands(change album), which anyone can do, copy and paste the info in any if the xxx.pl file's. #!/usr/bin/perl
system "echo 'XXXXX' > /tmp/iTunesRemoteControl";
system "chmod uga+rw /tmp/iTunesRemoteControl";
print "Content-type: text/vnd.wap.wml\n\n";
open MENU, "./menu" or die "'menu' not in current dir";
while (<MENU>) {print "$_";}
close MENU; #!/bin/bash
##########################################################
#Matthew Russell -25 Feb 05
#Usage: prompt$./iTunesRemoteControlDaemon.scr &
#
#This simply reads a file and executes an AppleScript that
#controls iTunes based on its content.
#
#kill the daemon with script killRemoteDaemon.scr
##########################################################
############
#User Prefs
############
scriptDir="/Library/WebServer/CGI-Executables"
remoteCommand="/tmp/iTunesRemoteControl"
delay="1.0"
#############
#begin script
#############
while [ 1 ]; do
status=`cat $remoteCommand`
case $status in
"getlyrics") osascript $scriptDir/GoogleLyricSearch.scpt;;
"nextalbum") osascript $scriptDir/PlayNextAlbum.scpt;;
"open") osascript $scriptDir/open.scpt;;
"RandomTrack") osascript $scriptDir/RandomTrack.scpt;;
"Rewind") osascript $scriptDir/Rewind.scpt;;
"FastForward") osascript $scriptDir/FastForward.scpt;;
"MuteUnMute") osascript $scriptDir/MuteUnMute.scpt;;
"PlayPause") osascript $scriptDir/PlayPause.scpt;;
"VolumeDown") osascript $scriptDir/VolumeDown.scpt;;
"VolumeUp") osascript $scriptDir/VolumeUp.scpt;;
esac
echo "" > $remoteCommand
sleep $delay
done
I wrote this, And it doesn't work.
Realize that the code you've written is disjoint without the daemon. You serve up a page with perl...and perl just so happens to write the word "open" to a file. That's all well and good, but without having your daemon actually process the "open" command, it doesn't matter if you would have written Robinson Crusoe to the file (a great book that I highly recommend by the way).
So my advice would be to add an additional case statement to the daemon if you haven't done that (remembering to restart it afterward). Otherwise, the little AppleScript you wrote will never be called.
The crucial thing to realize here is that writing the word "open" to the file doesn't automatically call open.scpt for you.
How's that work?
M.