Running /usr/bin/osascript via CGI scripts in Mac OS X


Subject: Running /usr/bin/osascript via CGI scripts in Mac OS X
From: Zeke Runyon (zrunyon@mac.com)
Date: Sun Mar 03 2002 - 11:20:27 MST


I know this is a Yellow Dog Linux list, but does anyone know what's
wrong here:

I have this Perl script:

---------------------
#!/usr/bin/perl

# osascript.cgi - test of using the /usr/bin/osascript program via CGI

sub appleScript { # this runs AppleScript source code
         my $result = `/usr/bin/osascript -sh << 'END'\n$_[0]\nEND`;
         chomp $result;
         return $result;
}

# gets the current song playing in iTunes
my $song = appleScript( qq{
         tell application "iTunes"
                 name of current track
         end tell
} );

print "Content-type: text/html\n\n";

if ($song) {
         print $song;
} else {
         print "There was an error.\n";
}
---------------------

And it seems that the /usr/bin/osascript program won't run via CGI. The
program is readable and executable by all. What's wrong here?

z

:::

# Zeke Runyon, zrunyon@mac.com
# web: http://communistsquirrel.home.dhs.org/ (formerly zekeworld)
# linux: http://gloin.dyn.dhs.org/, email: zekemon@gloin.dyn.dhs.org
# PGP key fingerprint = 7084 3BA2 9BC3 9024 2840 F0AF B9F4 37EB 827E
6A7D
# ( i am ZEKE, squirrel king, lord of woodland fauna ! )



This archive was generated by hypermail 2a24 : Sun Mar 03 2002 - 11:34:44 MST