Trying to get finder to find another program that lives in my bundle

I have an AppleScript that is saved as a application bundle, it is sort of an wrapper for another program. It asks several questions and then creates and copies a custom plists to the HD for the other program to use. The other program lives inside of the bundle/contents folder of my script.

This secondary application is a custom program (I did not write it) and it is also saved as an application bundle. All of this is distributed inside of a disk image.

If the whole bundle (my script bundle with the other program inside of the contents folder) is dragged out of the disk image everything works great and my script can run the app that lives within it. However, if my wrapper program is run while it is still inside of the disk image I get an error “Can’t find (secondary program name) of Application Finder”. I am using a simple Activate application “AppName” command.

I thought maybe “showing” the Finder through code where the secondary program lived would help, it did not.
I used tell application “finder” to set theFileSize to (size of file “application name” of folder “Contents” of file “Installer”).

Any idea how I can get this to work (I can probably tell the users to drag the whole thing out of the image, but you know how well people listen to directions).

Thanks

As far as I know, as far as the xx.dmg is not expanded as an inline volume, the Finder doesn’t see the file.

A workaround may be to store the file’s pathname in the comments of the xx.dmg file.
So, you would be able to get the path without expanding the xx.dmg file.

But, I don’t understand how you may run your wrapper without opening the xx.dmg file in which it is stored.

If the xx.dmg file is expanded as the wrapper is defined as a bundle app, you may get it’s own path with path to me.

set p2m to path to me
tell application "Finder" to set targetPath to ((container of p2m) as text) & "targetScript.app:"
display dialog "" & targetPath

Yvan KOENIG (from FRANCE vendredi 29 août 2008 19:02:31)

Thanks. I’ll try your code.

My code works fine on my system, it is just when I try it on another Mac that I get the errors.
So I will have to wait until Tuesday to try it on another system

So, I was seeing a friend that has a Mac and thought I would test this on his computer.

I used your code:
set p2m to path to me
tell application “Finder” to set targetPath to ((container of p2m) as text) & “installer.app”
activate application “installer”

Now I get a window title “Choose Application”. Text is “Where is Installer”. and a list of all apps on the computer.

I have a feeling that I should have done something more with your code. I did try (it didnt work at all):
set p2m to path to me
tell application “Finder” to set activate application ((container of p2m) as text) & “installer.app”

Thanks

It seems that you missed the sentence:

The script is supposed to be in the xx.dmg file and of course this one must be expanded as a disk image to be usable.

Yvan KOENIG (from FRANCE dimanche 31 août 2008 10:56:54)