Call an Application Regardless of Version Name

I am building an applet utilizing InDesign that will be rolled out to a number of company locations. Rather than having to update the name of the application when the version name changes, I am hoping to get the application regardless of the new name. An example being able to use Adobe InDesign CC 2017 when it updates from Adobe InDesign CC 2016. I get the error, “Can’t get application of alias “Yosemite-Tom:Applications:” whose name contains {“InDesign”}. Access not allowed.” Is this possible?

Thank you.

--Get current version of Adobe InDesign.
set apps_folder to "/Applications/"
set appsFolder to POSIX file apps_folder as alias
tell application "System Events"
	if not (exists (application of ((application of appsFolder) whose name contains {"InDesign"}))) then
		display dialog "The InDesign application cannot be found. Please contact the AppleScript administrator."
	else
		display dialog "InDesign exists!"
	end if
end tell
end
end
end

Change your code to specify the app by its ID:

tell application id "com.adobe.InDesign"

Thanks Shane! I appreciate your help.

… and System Events knows the path to /Applications. No POSIX dance needed.

tell application "System Events"
	set appsFolder to path to applications folder
end tell

@t3snow
As far as I remember, when we speak to System Events, an alias (of a folder) may contain : aliases, disk items, files, file packages, folders but doesn’t contain application objects.

If we speak to Finder we may get application files but

set appsFolder to path to applications folder
tell application "Finder"
	application files of appsFolder as alias list
end tell

doesn’t return application files stored in subfolders of the applications folder.
When I downloaded for some test inDesign late Saturday, the installer put it in the subfolder “Adobe inDesign CC 2015” with a lot of complementary files/folder so even if you edit it to speak to Finder your code will not find Adobe InDesign CC 2015.app

Shane’s proposal is the good way to achieve your goal

I guess that if several versions of inDesign are available on your system, exactly as with Pages, it would be difficult to know which one will be triggered by

tell application id "com.adobe.InDesign"

Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) mercredi 31 aout 2016 19:14:25