Re: NSTask Help
Re: NSTask Help
- Subject: Re: NSTask Help
- From: Nathan Day <email@hidden>
- Date: Tue, 14 Jan 2003 22:27:23 +1030
you didn't really say what you where stuck on so here is something to
look at, if you want to pass arguments to you pearl script you need to
put each one in a separate element of an NSArray, (ie -d ../somepath is
two elements of you NSArray not one). You can only use an NSTaks
instance once you have to create a new one you you want to repeat a
task.
- (void) performLogoutIfAppropriate
{
if (![self isPreview] && countdownSecs <= 0)
{
NSDictionary * theErrorDict;
[NSTask launchedTaskWithLaunchPath:
@"/Contents/Resources/main.pl" arguments:nil]
[[[NSAppleScript alloc] initWithSource:@"tell application
\"loginwindow\" to <<event aevtrlgo>>"]
executeAndReturnError:&theErrorDict];
}
return;
}
On Tuesday, January 14, 2003, at 07:02 AM, Rhon Fitzwater wrote:
Hi all,
I don't have much knowledge on how to get an NSTask working or Obj-C in
general. I need my code to execute a perl script, and then an
applescript.
Note: The location of the perl script will eventually be in
/Contents/Resources/main.pl of the built program.
I looked at some documentation, but dont understand all of it. I was
hoping that someone out there could help me out with the code.
Here is what I have so far (there is a lot more code that works now,
but this is where the perl and applescripts need to get executed):
- (void) performLogoutIfAppropriate
{
if (![self isPreview] && countdownSecs <= 0)
{
// Code to execute perl script needs to go here (NSTask???)
// Code to execute applescript: tell application "loginwindow" to
<<event aevtrlgo>>
}
return;
}
What do I have to add to the code above to get that to work? I'll take
any help I can get. Thanks in advance.
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
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.
References: | |
| >NSTask Help (From: Rhon Fitzwater <email@hidden>) |