Re: Entourage -> rule -> attachments
Re: Entourage -> rule -> attachments
- Subject: Re: Entourage -> rule -> attachments
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 06 Nov 2003 03:01:41 -0800
On 11/6/03 12:47 AM, "julifos" <email@hidden> wrote:
>
I found the guilty! Aka "XMail.osax". For some unknown reason, the term
>
"attachments" of the line "set theAttachments to attachments of currMsg" was
>
mapping to the "attachments" parameter of XMail, instead being owned by
>
Entourage (simply removing XMail did the trick).
First osax namespace conflict reported in OS X. I'm not familiar with this
osax. But that's not the reason. AppleScript looks first in the target
application's dictionary, and 'attachment' is there, so it uses that one.
>
>
But I don't know why the first "attachments" maps to XMail and not the
>
second one (using "selection" instead of "current messages").
Here's why:
>
> ##############################
>
> tell application "Microsoft Entourage"
>
> set currMsg to current messages
>
> set theMsg to currMsg's item 1
>
> --> incoming message id 32180 of application "Microsoft Entourage"
>
> set theAttachments to attachments of currMsg
>
> --> {}
>
>
If you had said:
set theAttachments to attachments of theMsg
you would have got a different result, 'currMsg' - a rather foolish name for
a list (plural), if you ask me - was set to 'current messages' - the whole
list. Then you used it to mean the single item 1. I'd suggest 'currMsgs' for
the list so you can keep track.
I get the same thing, even with no osax:
tell application "Microsoft Entourage"
set currMsgs to current messages
set theAttachments to attachments of currMsgs
end tell
--> {}
Perhaps it ought to error, but Entourage implements 'property of [list of
objects]' for most objects, so you get {} instead.
This, however, which you first reported:
>
########################
>
tell app "Entourage"
>
set msgs to (current messages)
>
set msg to item 1 of msgs
>
set msgAttachments to attachments of msg
>
>
repeat with i in msgAttachments
>
display dialog (name of i)
>
end repeat
>
end tell
>
########################
may perhaps be your conflict at work. But I think it's a sort of "fake"
report, since it has the wrong app name. Did you try it with "Microsoft
Entourage"?
This one, which you reported next, looks like the real thing:
>
##############################
>
using terms from application "Microsoft Entourage"
>
tell app appName --> which is "Microsoft Entourage"
>
set currMsg to (current messages)
>
set theMsg to item 1 of currMsg
>
--> get subject and sender, this works OK
>
>
set theAttachments to attachments of currMsg
>
display dialog (length of result as text) --> "0"!!!
>
>
--> etc.
>
##############################
It already has the incorrect variable. I didn't notice it last time.
It's probably a good idea not to save a character or two when making
variable names, and to make a variable representing a list look like a
plural. In this case you knew it would be a single-item list, so you kept
thinking of 'currMsg' as the message itself, and that what got you into
trouble.
Even so, you're right to try to persuade your osax author friend to change
the keyword name to something that won't conflict with a number of different
email applications' terminology. 'attachment' is a very common term.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.