Opening an App...

I’m REALLY new to applescript and I’m trying to make an applescript to launch an app w/ a particular doc. My application (Navis SPARCS) saves my startup settings in a doc. When I doubleclick the startup doc, it automatically finds the latest version of the app and launches it… however I want more control on versions for rollouts so I want to specify which app to use when launching, e.g., I’ll name the Prod version PROD and the new one awaiting rollout NEWPROD.

I’ve tried
tell Application PROD
end tell

And it seems to launch the application OK, but it macsbugs out upon exit (the application vendor requires we run macsbugs with the app)… and actually Finder seems messed up even before I quit my app. Opening the volume doesn’t show me all the contents. Also, It is not even launching the app with the right settings so its not even “opening” my startup.doc

If I do a
tell Finder
Open file PROD
end tell

that launches the right app correctly, AND it doesn’t macsbugs or mess up finder BUT I need the settings that are found in startup.doc.

I could also do a
tell Finder
Open File Startup.doc
end tell

but it will launch the NEWPROD app every time! Its almost like I need to applescript the drag and drop onto the correct app?

Any help greatly appreciated.

Is this suitable?

tell application "Finder" to open alias path:to:file using ""

Thanks for the response.

When I do what you said, and check syntax, it says

Expected end of line, etc. but found ".

this is what my applescript looks like

Tell application “Finder” to open alias “TSS1:SPARCS:SPARCS”
using “TSS1:Sparcs:Start test.nsu”
end tell

and I get the error right on first doublequote of “TSS1…”

Does this compile (one line)?

Tell application "Finder" to open  alias "TSS1:SPARCS:SPARCS" using "TSS1:Sparcs:Start test.nsu"

when I put the whole thing on one line, it says
Finder got an error: Invalid key form.

and the
"open alias “TSS1:SPARCS…”

is highlighted.

Let’s test this (tested successfully here):

set thisFile to choose file with prompt "Please select the file to open."
set thisApp to choose file with prompt "Please select the application to use to open the file."

tell application "Finder" to open thisFile using thisApp

oooooooooh, we’re soo close.

After I select ThisFile and ThisApp, in my event log I see:

tell application “Finder”
open alias “…START test.nsu” using alias “…”

then my spinning wheel comes on and then I get a “Finder needs your attention”. In order to select Finder tho, I do a command+“.”.

then as soon as I select Finder from my topright list, the app automatically launches. What IS working is that I can tell it is using the document, because it has all right the startup settings, and I’ve tested selecting two different startup settings and its starting up as I selected.

Hmmm. I’m at a loss and don’t know what to try next. :cry:

Ok, I am no pro so this may be just worthless to you, but, hey its worth a shot.

set thisFile to choose file with prompt “Please select the file to open.”
set thisApp to choose file with prompt “Please select the application to use to open the file.”

tell application “Finder”
open thisFile using thisApp
end tell

I don’t know if this will do anything, but I have done this in several scripts and by pulling the Finder to the front, it avoids the need for the cmd+period. Sometimes
the Finder just works better at this kind of thing if it is in front.


Here three short syntaxes :

tell application "Finder" to ¬
	open (choose file) using ¬
		(choose file of type "APPL")
tell application "Finder" to ¬
	open (choose file) using ¬
		(path to (choose application))
tell (choose application) to ¬
	open (choose file)

Fredo d;o)