Mac10.6 bug? NSAppleScript can't work
Mac10.6 bug? NSAppleScript can't work
- Subject: Mac10.6 bug? NSAppleScript can't work
- From: william lee <email@hidden>
- Date: Mon, 13 Jul 2009 17:28:21 +0800
Hi,
I have a problem with Mac 10.6 Cocoa application embed Applescript now.
The following code works fine in Mac 10.5, and they are almost come from Apple Tech doc.
But they doesn't work in Mac 10.6.
My App will launch Mail.app, will create an out going message, but can't set the recipient.
And also return a error said:
"Mail got an error: Can't get outgoing message id 409110912"
It seems error happen during "tell theMessage" line, and "111" pop up as expected. "222" will not be reached.
Strangely, the exactly same code will work in AppleScript Editor in both 10.5 and 10.6.
Is this a bug in Mac 10.6 or my code error? Does anyone encounter this before?
Thanks
William L.
--------------------------------Part of code-------------------------------------------
NSString *scriptSource = @" \
tell application \"Mail\" to activate\n \
tell application \"Mail\"\n \
set theMessage to make new outgoing message with properties {visible:true, subject:\"sssss\", content:\"ccccc\"}\n \
display dialog \"111\"\n \
tell theMessage\n \
make new to recipient at end of to recipients with properties {address:\"
email@hidden\"}\n \
end tell\n \
display dialog \"222\"\n \
end tell";
int iRes = NSRunAlertPanel(@"scriptSource", scriptSource, @"OK", nil, nil);
NSDictionary* errors = [NSDictionary dictionary];
NSAppleScript* appleScript = [[NSAppleScript alloc] initWithSource:scriptSource];
if (appleScript != nil)
{
[appleScript executeAndReturnError: &errors];
iRes = NSRunAlertPanel(@"errors", [errors valueForKey:@"NSAppleScriptErrorMessage"], @"OK", nil, nil);
[appleScript release];
return true;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden