Re: Launching an App without NSWorkspace?
Re: Launching an App without NSWorkspace?
- Subject: Re: Launching an App without NSWorkspace?
- From: Mark de Jong <email@hidden>
- Date: Thu, 5 Sep 2002 07:19:51 -0700
Hmm ... what kinds of errors are returned? I just tried to generate
errors, and got none.
If the app doesn't exist or cannot be found, a dialog appears asking
for it.
If the script has errors in it, it simply fails.
However, the "theErrors" dictionary remains empty.
So, if "theErrors" doesn't help, then you're right. Just point it to
"nil" and forget about it.
-- Mark
On Thursday, September 5, 2002, at 05:08 AM, Rosyna wrote:
<some app> must be known by LaunchServices when you run this script or
else it will not function as you hoped. The standard is to ask the
user for the path to the app at this point.
And why not NSDictionary* theError=NULL; then later no [theError
release]; ?
Ack, at 9/4/02, Mark de Jong said:
As a different approach, you could use AppleScript to launch an app.
So, starting with Mark Steinberg's code, we make some simple
modifications as follows:
NSAppleScript *theScript = [[NSAppleScript alloc]
initWithSource:@"tell application \"<some app>\" to activate\r"];
NSDictionary *theError = [[NSDictionary alloc] init];
[theScript executeAndReturnError: &theError]; //Probably a good
idea to check for errors
[theScript release];
[theError release];
and "<some app>" should launch. My tests show that this works.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
---
Please include any previous correspondence in replies, it helps me
remember what we were talking about. Thanks.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.