Microsoft Outlook

set mylist to (list folder "Macintosh HD1:Users:jbradfield:Desktop" without invisibles)
set linebreaks to ""
repeat with i from 1 to (number of items in mylist)
	set linebreaks to (linebreaks & (item i of mylist) & return) as string
end repeat
tell application "Microsoft Outlook"
	--activate
	CreateMail Body (linebreaks as string) Recipients "jbradfield" Subject ((number of items in mylist) & " New Images on NAIIS") as string without Display
	
end tell

This gives me

error

this used to work but for some reason stopped

btw this is a snipet of a larger script

i have narrowed the problem down to the Body of the email but can’t figure it out

Any help would be greatly appreciated

What happens if you coerce ‘number of items in myList’ to text?

CreateMail Body (linebreaks as string) Recipients "jbradfield" Subject (((number of items in mylist) as text) & " New Images on NAIIS") as string without Display

the error definatly happens in the body portion
i took out everthing else 1 at a time and when i change the body to “” it works fine

Maybe it’s a syntax issue. Can you post the relevant dictionary entry for the part of the script that is giving you problems?

this is from the dictionary of microsoft outlook (even though it says outlook express)

the error i receive is: :frowning:

wierd thing is this used to work the only thing i think that is different is i use script editor 2.0(beta) instead of 1.9 – i tried to run the same script in 1.9 and i still have same problem

PS when i look in the event log i do see the “body” portion as listing all the stuff that should be there

After further tinkering i am convinced that Micro$oft dosen’t want me to do it now they have installed a time delay virus that will no longer allow applescripting of Outlook
j/k

AS may be having trouble coercing the list into the body of the email don’t know why

ie when i try to

tell application "Microsoft Outlook"
	--activate
	CreateMail Body ((current date) as string) Recipients "jbradfield" Subject ((number of items in mylist) & " New Images on NAIIS") as string without Display

it works fine

some reason i am unable to force my list in there

any ideas?

If that’s what you suspect is wrong then I think you might need to build a string with each item in the list and then insert the string.

How would i go about that?

i thought that the repeat block was doing that as well as adding the line breaks

What happens if you replace:

CreateMail Body ((current date) as string) Recipients "jbradfield" Subject ((number of items in mylist) & " New Images on NAIIS") as string without Display

With:

CreateMail with properties {Body:((current date) as string), Recipients:{"jbradfield"}, Subject:((number of items in mylist) & " New Images on NAIIS") as string} without Display

This is tough when I can’t test the code to see if it even compiles. :?

CreateMail with properties {Body:((current date) as string), Recipients:{"jbradfield"}, Subject:((number of items in mylist) & " New Images on NAIIS") as string} without Display

will not compile the “{ or(” make it :frowning:

this is so frustrating why will it not work now?

tell application "Finder"
	--choose folder with prompt ""
	set linebreaks to ""
	set myFolder to folder "Macintosh HD1:Users:jbradfield:Desktop:move to enlarged"
	set naiislist to name of every item in myFolder --  as string
	set itemcount to the number of items in myFolder
	repeat with i from 1 to (count items in naiislist)
		set linebreaks to (linebreaks & (item i of naiislist) & return) as string
	end repeat
	tell application "Microsoft Outlook" to CreateMail Body linebreaks ¬
		Recipients ¬
		"jbradfield" Subject ((itemcount as string) & " New Images on NAIIS") with Display
end tell

OSX gives the following error

works perfectly in os9

any ideas?

if i take a list

set dalist to {“A”, “list”, “of”, “Items”} as list

the script works but it will not work on a list of file names

any idea why?
Please help :o

I’m shooting in the dark here and I feel your pain but “linebreaks” doesn’t happen to be a reserved word does it?

Nope! :frowning:

funny thing is in the events window i can see everyting the way it should be as far as the body the recipients and the subject everything shows up fine it just gives an error some data was the wrong type

Is there something different between a list of file names and a list of text?

becausea list like my previous post will work

and this works the way i want in os9

agh (&#^%#$%)$%_ just venting any body out there understand

anyway outlook is a free dl from m$ @
http://download.microsoft.com/download/Outlook2001Mac/Install/1.0/MacOS/EN-US/Outlook2001en.bin

I wish my work didn’t have to you use micro$oft outlook

If there is anyone out there that can help i would so appreciate it