fillemaker8 how email multiple attachments...or fm8 bug?

Hi,
anyone can help me with this applescript I’ve already built,
to sen email multiple attachments from filemaker ?
(I work on Filemaker 8 Pro Advance, Mac OSx 10.4.8)
I would need some extra advice to get this applescript perfect 4 my needs:

Let’s say I have a text field in Filemaker field called “XYZ” to copy into the email.
I’d need to alternate my text XYZ to the attachments so that in the
email body I’ll have something like this:

XYZ_1
attachment_1

XYZ_2
attachment_2 …

…ecc, ecc…

could you give me some advice to modify this applescript
4 my needs ?

thx alot in advance,
ciao,david

Applescript already working in FM 8 Pro Advanced:

tell application “FileMaker Pro Advanced”
set theSubject to cell “Subject” of current table
set theMessage to cell “Message” of current table
set theRecipient to cell “Recipient” of current record
set theAttachments to cell “Attachments” of current record
– return-separated Mac:file paths
set theSender to cell “Sender” of current table
end tell

set attachmentList to {}
repeat with i in paragraphs of theAttachments
set theAttachment to i
set aliasAttachment to theAttachment as alias
set attachmentList to attachmentList & aliasAttachment
end repeat

set theMessage to theMessage & return & return
– otherwise it jams it up against the text

tell application “Mail”
activate
set newMessage to make new outgoing message with properties
{visible:true, subject:theSubject, content:theMessage}
tell newMessage
set sender to theSender
make new to recipient at end of to recipients with properties
{address:theRecipient}
tell content
repeat with i in attachmentList
make new attachment with properties {file name:i} at after the
last paragraph
end repeat
end tell

           --Other possible option to evaluate
         -- save newMessage
           -- send newMessage
           -- switch the commenting on the above 2 lines to send immediately
   end tell

end tell

Model: PowerBook G4, 1.25 GHz
AppleScript: Versione 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

have you looked at doing this from FMPs “Send Mail” script step that may make it easier by you may not be able to achieve what you are trying to do. also did this script work at one time ?

MM

hi mcgrailm,
I’ve already tried…, i’ve made a lot of search on internet, …
…and for sure filemaker 8 and 8.5 can not send multiple attachments without an external plug-in.

So I was succesfull with my applescpript…but I still need some advice to implement it!
are you quite good in applescript?
th’ks,
dave

I consider myself to be a fairly good scriper… it looks as thought you have would you need and looks to me like your going about the right way… I’m will to help if I can

yes! your’ re right…

would you have some advice, about how implementing my above script?
thx,dave

Dave,

sorry for my last reply that I’m surprised you were able to make sense of it.:smiley:

are you asking how to call the applescript from FMP ?

if you are there is a script step in FMP call “perform apple script” you can put your applescript into that script step then put a button in your fmp database that calls that script step

mm

Well actually , this is what I’m exactly asking:
could you give me some advice to modify this applescript
4 my needs ?

thx alot in advance,
ciao,david

I would need some extra advice to get this applescript perfect 4 my needs:

Let’s say I have a text field in Filemaker field called “XYZ” to copy into the email.
I’d need to alternate my text XYZ to the attachments so that in the
email body I’ll have something like this:

XYZ_1
attachment_1

XYZ_2
attachment_2 …

…ecc, ecc…

Applescript already working in FM 8 Pro Advanced:

tell application “FileMaker Pro Advanced”
set theSubject to cell “Subject” of current table
set theMessage to cell “Message” of current table
set theRecipient to cell “Recipient” of current record
set theAttachments to cell “Attachments” of current record
– return-separated Mac:file paths
set theSender to cell “Sender” of current table
end tell

set attachmentList to {}
repeat with i in paragraphs of theAttachments
set theAttachment to i
set aliasAttachment to theAttachment as alias
set attachmentList to attachmentList & aliasAttachment
end repeat

set theMessage to theMessage & return & return
– otherwise it jams it up against the text

tell application “Mail”
activate
set newMessage to make new outgoing message with properties
{visible:true, subject:theSubject, content:theMessage}
tell newMessage
set sender to theSender
make new to recipient at end of to recipients with properties
{address:theRecipient}
tell content
repeat with i in attachmentList
make new attachment with properties {file name:i} at after the
last paragraph
end repeat
end tell

           --Other possible option to evaluate
         -- save newMessage
           -- send newMessage
           -- switch the commenting on the above 2 lines to send immediately
   end tell

end tell

Dave,

ok what you want to to do is something like this only you need to repeat through your file name and attachment at the same time


set i to (choose file)
tell application "Mail"
	activate
	set newMessage to make new outgoing message with properties {visible:true, subject:"test", content:""}
	tell newMessage
		tell content
			set paragraph 1 to "this is the name" & return
			make new attachment with properties {file name:i}
		end tell
	end tell
end tell

does that make sense ?

MM

that last post didn’t work well in repeat loop

you actually need to build the paragraphs first then place the attachments here is an example


set i to (choose file)
set x to (choose file)
tell application "Mail"
	activate
	set newMessage to make new outgoing message with properties {visible:true, subject:"test", content:""}
	tell newMessage
		tell content
			set paragraph 1 to " " & "this is the name" & return & return
			set paragraph 2 to " " & "this is the next name" & return & return
			make new attachment with properties {file name:i} at front of paragraph 1
			make new attachment with properties {file name:x} at front of paragraph 2
		end tell
	end tell
end tell