script FORMULA
on OpenFormula_(sender)
set posixPath to (current application's NSBundle's mainBundle's pathForResource:"FORMULA" ofType:"app") as string
set posfile to (posixPath as string) as POSIX file
set FP_1 to posfile as string
open FP_1
activate
end OpenFormula_
end script
Hi
I am trying to open an application that is stored in my Xcode application using the above, but it errors with
AppleEvent timed out. (error -1712)
the code above works fine opening .applescript files from within my app, but not this one, do I need
to change this approach to do what I need?, if so to what please?, thanks for any help.
edit: another error thrown was the document “Formula” could not be opened, MY APP cannot open files
in the “application” format.
set FP_ to (current application's NSBundle's mainBundle's pathForResource:"Formula" ofType:"app") as string
run application FP_
activate application "Formula"
set appURL to current application's NSBundle's mainBundle's URLForResource:"FORMULA" withExtension:"app"
current application's NSWorkspace's sharedWorkspace()'s launchApplicationAtURL: appURL options:0 configuration:(missing value) |error|:(missing value)
I have this error:
-[NSWorkspace launchApplicationAtURL:options:configuration:]: unrecognized selector sent to instance 0x600000208360 (error -10000)
The following code works for me:
set appURL to quoted form of ((current application's NSBundle's mainBundle()'s pathForResource_ofType_("FORMULA", "app")) as string)
do shell script "open -a " & appURL