| 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 11:56:22 | |
| From: | Cool6324 | |
|
Response to: I wrote this, And it doesn't work.
|
||
|
Works Great, I'm going to write one to close iTunes, now. This is so kool, I always wanted to do this too. Now, I want to have a script that Auto-Starts the deamon, from the dock, and I have done done so, but terminal just locks. So that "&" where would I put it so terminal doesn't hang.
|
||
Showing messages 1 through 3 of 3.
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.
If it doesn't work, you might want to ask if you actually reboot your system enough to merit going through the trouble of auto-starting this.
If you want to proceed, I'd question why you're using AppleScript to simply run a shell script. You don't need this extra layer of scripting. Your shell script doesn't need to run as admin either. It just needs to run as your user account.
The link I posted before that references login hooks on bombich.com should have been a pointer in the right direction. You ultimately want to have this thing start up as a normal daemon process just like lots of the other things that start up, right?
If you just want a double clickable item to run the script for the dock, you can do that by researching some more on Terminal and saving a terminal session as a Term file. In fact, there a long series here on macdevcenter about that.
M.