Re: Mac10.6 bug? NSAppleScript can't work
Re: Mac10.6 bug? NSAppleScript can't work
- Subject: Re: Mac10.6 bug? NSAppleScript can't work
- From: Alexander von Below <email@hidden>
- Date: Mon, 13 Jul 2009 18:55:57 +0200
If you do not receive any reply to your questions, it is likely due to
these things:
1) "Be sensitive in choosing where you ask your question. You are
likely to be ignored, or written off as a loser, if you: ... • cross-
post to too many different newsgroups"
2) "When selecting a Web forum, newsgroup or mailing list, don't trust
the name by itself too far; look for a FAQ or charter to verify your
question is on-topic"
Both quotes from: http://catb.org/esr/faqs/smart-questions.html.
That said, the right place for this question is:
https://devforums.apple.com/community/mac
Alex
Am 13.07.2009 um 11:28 schrieb william lee:
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-implementors mailing list (email@hidden
)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden