-- Get Path to frontmost application set appl to path to frontmost application as string -- Get app's name tell application appl set appname to name end tell -- Other Program support if appname is "iTunes" then -- iTunes Support -- Known supported versions: 7.1.1 (5) -- Known bugs: -- #1: When looking at 'iPod Games' or the iTunes Store, these don't return special kinds or valid names (returns the value of windowtitle last time it ran somehow?!?), so I've set it to set iTunes as default. This appears to be a bug in iTunes, as there seems to be no other way to get this information through AppleScripting. (Also, it's possibly because these aren't browser windows, and their (view) has different stuff or they don't have a view) tell application "iTunes" set windowtitle to "ITS_OR_IPG" -- bugfix (#1) if visuals enabled then set windowtitle to name of current visual else try set windowtitle to name of view of window 1 catch try set windowtitle to special kind of view of window 1 catch set windowtitle to "iTunes" end try end try end if if windowtitle is "ITS_OR_IPG" then -- bugfix (#1 cont'd) if window 1 is EQ window 1 then set windowtitle to "Equalizer" else set windowtitle to "iTunes" end if end if end tell else tell application appl set windowtitle to name of window 1 end tell end if if windowtitle is appname then return "I am looking at " & appname & "." as string else return "I am looking at " & "\"" & windowtitle & "\"" & " in " & appname & "." as string end if