scripting the finder and entourage

hello all,

i had a script that checked a certain folder for JPEG images and then ataches them to an entourage mail message. now i also have in that folder thumbnails JPEG images that i don’t want them attachached with the message. i’m always sure that my thumbnail JPEGs’s names always contain “thumb” for example “test_thumb.jpg” i tried to edit my previous code but it’s not working whenever it reaches the point to attach the messages it gives me an error…


set theAttachment to "Mac HD:Resources"
--it's the folder where i have my pics
set theSubject to "this is a test subject"
set theBody to "this is a test body"

tell application "Finder"
	set theAttachments to files in alias theAttachment whose file type is "JPEG"
	repeat with i from 1 to count theAttachments
		set testthumb to (theAttachments's item i)
		set test to (name of testthumb)
		if not (test contains "thumb") then
			set theAttachments's item i to (theAttachments's item i) as alias
		end if
	end repeat
end tell
tell application "Microsoft Entourage"
	set newMessage to make new outgoing message at out box folder with properties {subject:theSubject, content:theBody, attachment:theAttachments}
end tell

i tried my best to figure out what’s going on… but i didn’t…
can anyone help? this is an urgent matter

thanks,
psycho-ed

Given that you’ve played with the extensions, you should go after them rather than types:

tell application "Finder" to set f to name of files of alias "path to your folder" whose name extension is "jpg"

i founf a way… thanks for ur help

It’s still a one-liner:


tell application "Finder" to set theAttachments to name of files of alias "ACB-G5_1:Users:bellac:Desktop:Attachments:" whose name extension is "jpg" and name does not contain "thumb"

Also, theAttachments is an AppleScript list. Can Entourage deal with that or do you have to set up a loop to add them one at a time?