Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7359 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi there.

I've installed the Xmail (OSAX style) Scripting Addition.

I'm trying to have Filemaker generate a calculated Applescript that

sends attachments to a file (or files, hopefully), specificied by the path

of a container field. I can send emails fine with the script, but can't seem

to send an attachment (regardless of whether the file is local or on a mounted

network drive). The path I'm trying to send to is valid, because the

send mail script step sends the attachment just fine.

Could someone please take a peek and take a guess as to what's wrong ?

Here's what the calculated script ends up looking like:

Set toList to {

Posted

I've got XMail, but haven't used it yet; looks good though; can't beat the price. Two things off the bat. First, and this may just be the way you've posted this; an AppleScript command is generally all on 1-line. All of the above should be one line. You can "break" the line for readability by typing an Option-Return (looks like a baby return :-)

The fatal flaw however is that you're trying to use a FileMaker type file path. AppleScript uses either the old Mac style file path, or a UNIX file path (which is closer to FileMaker's), with the "POSIX path of" coercion; but neither are the same as FileMaker's path (especially with the "filemac:" part). Why can't they all be the same you may ask; alas in vain.

"filemac:/Earth/Users/johnny/Desktop/2004class4.jpg"

could be constructed as:

alias ( (path to desktop as string) & "2004class4.jpg")

path to desktop returning the current user's desktop. If you have the file name in a field (in FileMaker, this would be in a Perform AppleScript step), you could set that into an AppleScript variable, then just tack it on:

tell current record of window 1 -- or whatever

set fileName to cell "File Name"

end tell

set theFile to alias ((path to desktop as string) & fileName)

I don't know if it insists on a list, or if it's happy with just a single file. Usually they are. If not, then add "as list" to the end, with () parenthesis around the rest.

set theFile to (alias ((path to desktop as string) & fileName)) as list

Posted

Calculated applescripts are not the way to go. Paste the script into a "perfom applescript" step.

One of the problems I see in your script is all the returns.

Set toList to {

Posted

thanks a lot guys.

this works: set theFile to (alias ((path to desktop as string) & fileName))

but.. I'm trying to pull the filenames from the container fields on each of my records.

(so, I'm thinking that I'll be declaring a variable that sets attachments to a few files, separated by

commas in the appropriate applescript syntax)

they often, will not be on the desktop of the server.. is there a way to dynamically convert the path that

filemaker container field sees into a path that applescript can use ?

(or a way I can at least figure out what the applescript path needs to be so that I can convert them by some brute force calculation)

Fenton--when you say tell current record of window 1 -- or whatever

is the #1 here actually the window name as a string or do I need to find the window ID ?

Bruce- when you say calculated applescripts are not the way to go --what is the problem with them... is this because I should rather use the method Fenton describes:

tell current record of window 1 -- or whatever

set fileName to cell "File Name"

end tell

set theFile to alias ((path to desktop as string) & fileName)

again, thanks guys.

Posted

This calculation gives me a Mac file path from an image inserted as file reference. You'd change the "imagemac:" to "filemac:" for a file (I think):

Substitute(MiddleValues(GetAsText(PictAsRef); 3; 1); [ "/"; ":"]; ["imagemac::"; ""], ["

Posted

got it !! thanks a lot.. I didn't have much hope at first that I'd be able to get this working... it took me a little while to wrap my head around Applescript..(and I'm not a programmer) I think it's making more sense now! and at the very least, its' working!

thanks again.

This topic is 7359 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.