Re: AppleScript...
Re: AppleScript...
- Subject: Re: AppleScript...
- From: Chris Garaffa <email@hidden>
- Date: Mon, 8 Mar 2004 22:15:00 -0500
On Mar 8, 2004, at 8:21 PM, Jerry LeVan wrote:
How come I have to use "\n" in the NSAppleScript call below but Script
Editor and
osascript do not require the new line character?
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *cmd= @"tell app \"Finder\" \nopen posix file
\"/Users/jerry/Documents/SQL Stuff\"\n end";
NSDictionary *err= [[NSDictionary alloc] init];
NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource:cmd];
NSAppleEventDescriptor * result =[myScript executeAndReturnError:
&err];
NSLog(@"result:%@",result);
NSLog(@"err:%@" ,err);
//system("osascript -e 'tell app \"Finder\" to open posix file
\"/Users/jerry/Documents/SQL Stuff\"'");
[pool release];
return 0;
}
Jerry,
You're using two different versions of the call here. In the
NSAppleScript version, you're creating a tell block (which requires the
associated end). In the commented out system() call, you use "to". This
means you don't have an entire block (so you don't need the end tell).
Set cmd to the argument you pass to osascript and you should be all set.
--
Chris Garaffa
email@hidden
_______________________________________________
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.