nasty problem with iTunes

iTunes continues to create problems, it compiles as “TodayExtension.appex” which causes an error in Script editor or non running scripts outside of Script editor.

I know there is a way to call applications with its application id, but i havent used this technique yet. Where can i retrieve such information ?

In AppleScript Language Guide we may read :

The following statements specify the TextEdit application by, respectively, its signature, its bundle id, and by a POSIX path to a specific version of TextEdit:
application id “ttxt”
application id “com.apple.TextEdit”
application “/Applications/TextEdit.app”

If we replace TextEdit by iTunes, I don’t know which is the valid signature but the bundle id is com.apple.iTunes and the standard POSIX path is “/Applications/iTunes.app”.
The bundle id of an application may be found in its info.plist file at theApp.app/Contents/info.plist

I dislike the Finder but here is a case where it may help :

set theApp to (path to applications folder from local domain as text) & "iTunes.app"

tell application "Finder"
	id of file theApp --> "com.apple.iTunes"
end tell

Don’t ask me why, System Events is unable to give us this information.

It would be interesting to read in which environment you got iTunes compiled as “TodayExtension.appex”. Here it compiles flawlessly as iTunes.

Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) lundi 21 décembre 2015 14:54:39

You can still avoid it:

set theId to id of application "iTunes"

Thanks Shane.

Where is this feature described ?
I searched in AppleScript Language Guide : no luck.
I searched in Standard Additions : no luck.
I found it in Has’s “Learn AppleScript” but it’s not an “official” source, it’s a good third party one :wink:

Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mardi 22 décembre 2015 17:58:39

Look again :wink:

Thanks

I searched in AppleScript Language Guide PDF ©2013. and found nothing.
After reading your answer I searched again but this time didn’t searched for “id of” but for “id”
It was a bit boring because it flagged very often id inside words, but a last I got :

id
Access: read only
Class: text (page 123)
The application’s bundle identifier (the default) or its four-character signature code. (New in AppleScript 2.0.)
For example, the bundle identifier for the TextEdit application is “com.apple.TextEdit”. Its four-character signature code is ‘ttxt’. If you ask for an application object’s id property, you will get the bundle identifier version, unless the application does not have a bundle identifier and does have a signature code.

Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mardi 22 décembre 2015 23:37:41

IMO, if you have reasonable Internet access, choosing Show AppleScript Language Guide from Script Editor’s Help menu is both convenient and guaranteed to be as up-to-date as it’s ever likely to be.

Shane, that opens up the guide, but how do you search just that guide?
The search box at the top searches the entire Mac Developers Lib.

I’m hoping I’ve overlooked the obvious.

Thanks.

You can’t directly, but scroll down to the end of the Table of Contents and you will see it has a pretty comprehensive index.

It would be interesting to read in which environment you got iTunes compiled as “TodayExtension.appex”. Here it compiles flawlessly as iTunes.

its probably because my iTunes misses yet some important property list items which are added the first time you connect to the Internet.
El Cap broke the driver of my router and currently theres no driver update in sight so i have to navigate on another Mac with 10.7.5.

set appl_ls to (path to applications folder as text)
tell application "Finder" #choose menus work unreliable without Finder support
	activate
	set getapp to choose file default location alias appl_ls with prompt "Choose Application..." #of type "APPL"
	if getapp is false then return
end tell

log (get id of application (getapp as text))

“pretty comprehensive” for those whose main language is English.
When it’s not the case,being able to apply a search in the full text is easier.

I’m glad to have the User’s manual of iWork’09 applications in PDF files.
I find my way in them.
Awful detail, as the help available in French is a translation of the English one, it seems that its indexing was not rebuild from the French text but is a translation of the English index. So when I need info about a newly added feature, I find it in the English version with less pain than searching in the French version.

Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 23 décembre 2015 18:57:46

Too much work. Try this:

set theApp to choose application
log (get id of theApp)