What happens when a target app isn't installed?

I’m having a bit of trouble with my 2nd app trying to get it on the App Store. It targets Adobe InDesign, and my description clearly states you must have it. But the MAS people want to test it when InDesign ISN’T on their computer. :mad: They keep getting the “please locate InDesign” message. Duh.

But here’s the odd thing that really kills it- the dialog shows up not 1x but 2x or more. I tested the app on a volume where I zipped InDesign and threw away the folder. I got the dialog 2x but after that nothing happened.
Now, if it would only show up 1x then the MAS reviewers would be OK with that because it “doesn’t seem buggy”.

This app does have several ASOC classes, 9 of them and 6 of them call InDesign. The AppDelegate class calls InDesign and I would expect that to show a “where is…” dialog. I have a drawer that has a script to control the buttons in the drawer, but the drawer isn’t shown by default. Could this code be calling InDesign right away too? The other couple script classes don’t do anything until a button is pushed. Maybe that is making the dialogs not show up 4 more times for those classes?

Is there any way to somehow build an app that doesn’t require calling the target app’s dictionary on startup at all? Tips welcome, even crazy ones. I don’t know wtf to do about this.

Chris

So let me reply myself. It appears that I had a call to InDesign in both my “will finish launching” and “app became active” blocks. And both will fire when an app is started up. So I had to remove the call to InDesign in one of them.

This still strikes me as a problem with the framework, as a call to the SAME APP from different places in a code/class should NOT display multiple warning dialogs. Somehow the app should get a reference to the target app and then keep it around for the life of the app, and reuse it for other calls from any handler.

Maybe I’ll bug file later.:confused:

Are you using the ‘tell application id “com.adobe.InDesign”’ form?

Well First of all in my application I locate the bundle first with lsregister. Here you can find if the bundle is installed or not on the local machine, where it is installed and which version is installed. I’m not sure if it matters but I have (in my case Quark) every call to the other operation in one single class and will only be loaded when I’m sure the other application is on the local machine. For to determine the right version(s) of Quark is installed I use this.

try
	set installedQuarkVersion to do shell script "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | grep -i --after-context=6 'name:[[:space:]]*QuarkXpress$' | grep version | awk '{print $NF}'"
on error
	set installedQuarkVersion to null
end try

if installedQuarkVersion is not "8.5" then
	return
end if

This way the ‘bridging’ script isn’t loaded when Quark (or the right version) isn’t installed and therefore the Application won’t ask where Quark is because it isn’t loaded in the interpreter.

Shane,
no I was using the regular “tell app Adobe Indesign CS5…”

DJ
Thanks that is a cool bit of code, I will give that a try sometime, maybe soon.

If you use the id method, you get an error (which you can trap) rather than the application search dialog.

Use shane’s method if version is not important.

try
	set appID to "com.apple.Finder"
	tell application id appID to set APPVersion to version
on error errmsg
	set APPVersion to null
end try

if APPversion is null then
return 
end

Why I use that previously code/l
For our company it’s important to launch sometimes QuarkXPress 6, 7 or 8 and they all have their own ‘bridges’ with all same handler names. So depending on the file version, the right version of Quark is used and the right bridge is loaded. the code above will always lookup the latest version…

(Sorry to resurrect old topics)
I was in need of using this again, and I have built a (Cocoa) daemon that has no UI. It doesn’t seem to make a pref file, I can’t find a “com.company.MyDaemon” pref anywhere, so Shane’s version doesn’t seem to work. DJ’s version does, and if there are multiple copies on a machine then I get text that lists all the versions → “1\r2.0.1\r3.1” etc. That’s fine for me now since I don’t need to track the version, so long as the value isn’t null (or empty) my script will work.


try
	set installedAppVersion to do shell script "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | grep -i --after-context=6 'name:[[:space:]]*AppNameDaemon$' | grep version | awk '{print $NF}'"
	-->this might return an empty string, or multiple values "1\r2.1\r3.0.1" etc
on error
	set installedAppVersion to null
end try

if installedAppVersion is "" or installedAppVersion is null then
	return
end if