Re: Basic Outlook Express script
Re: Basic Outlook Express script
- Subject: Re: Basic Outlook Express script
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 17 Sep 2002 16:57:32 -0700
On 9/17/02 2:13 PM, "John Cebasek" <email@hidden> wrote:
>
Paul:
>
>
(Guess what sort of server we have here at work, huh?)
In that case calling it "OE" seems something of a misnomer. Are you _sure_
you use Outlook 2001? OK
>
>
It's Outlook 2001. I did happen to get this to almost work, but the values
>
don't seem to be appearing in the mail message:
>
>
on send_email_message_OE(targetAddress, targetName, subjectLine, theSender,
>
messageText, fileAttachment)
>
tell application "Microsoft Outlook"
>
activate
>
set theDoc to {fileAttachment} as list
>
set messageContent to messageText as
>
string
>
set emailsubject to subjectLine as string
>
set theRecipient to
>
{targetAddress} as list
>
set carbonCopyRecipients to {""} as list
>
set
>
blindcarbonCopyRecipients to {""} as list
>
set showMe to true
>
>
--
>
CreateMail {Subject:subject, theContent, theDoc, theRecipient,
>
ccRecipients, |display|}
>
CreateMail {|subject|:emailsubject,
>
|body|:messageContent,
>
|attachments|:theDoc, |recipients|:theRecipient,
>
|cc_recipients|:carbonCopyRecipients,
>
|bcc_recipients|:blindcarbonCopyRecipients, |showMe|:false}
>
>
>
end tell
>
end send_email_message_OE
>
>
send_email_message_OE("email@hidden", "me", "Hi
>
There",
>
"email@hidden", ,
>
"Starting OE Support for Export wizard", "OS X:Norton
>
AntiVirus Installer
>
Log")
>
>
What's with the pipes after you check syntax in the editor?
You're doing the whole thing incorrectly. Nowhere in the Outlook dictionary
does it show any records with labels. It's just a command with parameters
and their values which you string together like this, without colons or
commas:
CreateMail Subject emailsubject Body messageContent Attachments {theDoc}
Recipients {theRecipient} CC_Recipients {carbonCopyRecipients}
BCC_Recipients {blindcarbonCopyRecipients} Display showMe
That compiles. The reason you're getting pipes is because you were using
application keywords in a way they aren't supposed to be used, so
AppleScript assumed you were using your own variables (record labels,
actually). In order to avoid a conflict with the genuine keywords, it puts
user variables in pipes. you'll see that with the correct syntax, you don't
get pipes. Here's how to do it using your set-up:
on send_email_message_OE(targetAddress, targetName, subjectLine, theSender,
messageText, fileAttachment)
tell application "Microsoft Outlook"
activate
set theDoc to {fileAttachment}
set messageContent to messageText
set emailsubject to subjectLine
set theRecipient to {targetAddress}
set carbonCopyRecipients to {""}
set blindcarbonCopyRecipients to {""}
set showMe to true
--
CreateMail Subject emailsubject Body messageContent Attachments
{theDoc} Recipients {theRecipient} CC_Recipients {carbonCopyRecipients}
BCC_Recipients {blindcarbonCopyRecipients} Display showMe
end tell
end send_email_message_OE
But there's no reason to rename all the handler parameters. Why are you
double-doing everything? And the dictionary puts the parameters in [square
brackets]. That means they're not required - so if you don't have CC or BCC,
just leave them out. Also, you don't have to keep saying 'as string' when
its already a string, and 'as list' when it's already a list. (AppleScript
is not strongly typed, and we don't have 'Dim's.) But you missed the weird
'list of list' in the dictionary for most of the parameters. that implies
that the component lists might be more complex. (I don't understand why it's
not simply 'list of string'.) You also have extyra parameters you're not
using. I can't test this, since I don't have Outlook. Maybe the 'list of
list' is wrong and it should be 'list of string'. If the dictionary is
correct, this should work:
----------------------
on send_email_message_OL(targetAddress, subjectLine, messageText,
fileAttachment) -- one line
tell application "Microsoft Outlook"
activate
CreateMail Subject subjectLine Body messageText Attachments
{{fileAttachment}} Recipients {{targetAddress}} with Display -- one line
end tell
end send_email_message_OL
send_email_message_OL("email@hidden", "Hi There", "Starting OE Support
for Export wizard", "OS X:Norton AntiVirus InstallerLog") -- one line
------------------------------
--[Unwrap long lines hard-wrapped by email]
--
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.