MACSCRPT Archives

July 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Peter Boardman <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 12 Jul 2006 18:00:04 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (25 lines)
This AppleScript tests to see if iTunes is running before getting the  
track name:

tell application "System Events"
	if (exists process "iTunes") then tell application "iTunes" to if  
player state is playing then get name of current track
end tell

returns

tell application "System Events"
	exists process "iTunes"
		false
end tell

if iTunes isn't running. But the same script wrapped inside osascript  
always launches iTunes:

print `osascript -e 'tell application "System Events"
if (exists process "iTunes") then tell application "iTunes" to if  
player state is playing then get name of current track
end tell'`

Why should this be? And is there a way of doing it?

ATOM RSS1 RSS2