MACSCRPT Archives

July 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

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

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

Print Reply
Mime-Version:
1.0 (Apple Message framework v752.2)
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Subject:
From:
Peter Boardman <[log in to unmask]>
Date:
Wed, 12 Jul 2006 18:00:04 +0100
Content-Type:
text/plain; charset=US-ASCII; delsp=yes; format=flowed
Content-Transfer-Encoding:
7bit
Reply-To:
Macintosh Scripting Systems <[log in to unmask]>
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