Re: ARC and NSApplescript
Re: ARC and NSApplescript
- Subject: Re: ARC and NSApplescript
- From: Chris Paveglio <email@hidden>
- Date: Tue, 23 Apr 2013 14:38:36 +0000
- Thread-topic: ARC and NSApplescript
Title: Re: ARC and NSApplescript
Ron, thanks.
That works. Looks like I was remiss in my coding practices. I was calling the script but not returning the value. I need to clean up my act with ARC! :-)
Chris
[script executeAndReturnError:&errorDict]; //oops, should be:
NSAppleEventDescriptor *result = [script executeAndReturnError:&errorDict];
On 4/23/13 10:18 AM, "Ron Reuter" <email@hidden> wrote:
As always, I try to write a simple program to test potential problems. Here's my console test, which works fine in 10.7 and 10.8, ARC on, Xcode 4.6.1.
#import
<Foundation/Foundation.h>
NSString *goodScript = @"on test()\n return \"Hello world\"\nend test\ntest()\n";
NSString *errorScript = @"on test()\n error number -1\nend test\ntest()\n";
int main(int argc,
const char * argv[])
{
@autoreleasepool {
NSDictionary *errorDict;
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:goodScript];
NSLog(@"Script: \n%@", goodScript);
NSAppleEventDescriptor *result = [script executeAndReturnError:&errorDict];
NSLog(@"Result: %@", result);
NSLog(@"Dictionary: %@", errorDict.description);
}
return 0;
}
• Ron
On 22 Apr 2013, at 3:28 PM, Chris Paveglio <email@hidden> wrote:
ARC and NSApplescript
Does anyone have any info on using NSApplescript in straight Objective C? I’m converting an app that used garbage collection with an NSApplescript object, compiling for 10.6 it worked fine. Now I’ve upgraded the code to 10.7 and using ARC and of course no GC.
No change to that code. The app breaks on an exception on the line
[script
executeAndReturnError:&errorInfo];
Running the compiled script from Script Debugger works with no errors, so it’s not the script itself.
Is this a known thing that ARC doesn’t work with NSApplescript? Or is it likely something else?
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden