grumbachr Posted December 4, 2008 Posted December 4, 2008 Scripts that work properly in with Mail.app and Thunderbird only work part way in Entourage. I expect the script to create a new mail message and open it for the users to review and send. When the default client is Entourage the message is created correctly but only as a draft in the Drafts folder(On My Computer). The user then has to go into that folder, open the message and then send it. Any trick to making it open this message automatically for review?
Fenton Posted December 4, 2008 Posted December 4, 2008 You could use AppleScript to do the email if the client is Entourage. But that brings up 2 questions: 1. How do you know?, and 2. How do you do it? #1 may be tricky. I've got this (attached) AppleScript (by Kai) which can be run to tell you what the "default" email client is. You would need to set a FileMaker field (global) with this; which I can't do for you, as I don't have your file. #2 is less tricky, but you'd also need an AppleScript to do this. I have AppleScript's for Mail and Eudora, but cannot seem to find any for Entourage to create a new email. It would be similar to one for Mail, as their AppleScript dictionaries are very similar. I'm sure you can find one. Default_email.scpt.zip
grumbachr Posted December 5, 2008 Author Posted December 5, 2008 Thanks Fenton. I got the script to pass the default mail app on to filemaker. I see a few places were it easily breaks the way I've done it, and I'm not sure I want to sink the effort into fixing it just yet. I'm not that familiar with Applescript and I'm not sure I have the time for it just yet considering what its trying to fix. I was hoping it be an "easy" fix like something I was overlooking in a setting some where. This is pretty cool and I keep a technique like this in mind if I run into something where I really "need" it. Thanks again.
Fenton Posted December 5, 2008 Posted December 5, 2008 It is pretty simple to set up an email with AppleScript, with either Mail or Entourage. Here's an example. It may or may not however; I have Entourage, but I have no accounts in it, nor really wish to (as then I'd have to configure them to not check the mail). Just so you can see how simple it is: tell application "FileMaker Pro Advanced" -- you'll have to match the AppleScript variables to your FM fields set emailaddress to cell "designer" of current record set JobDescription to cell "JobDescription" of current record set JobStatus to cell "JobStatus" of current record set MailSubject to cell "key" of current record end tell tell application "Microsoft Entourage" activate set MyMessage to make new outgoing message with properties ¬ {recipient:emailaddress, subject:MailSubject, content:JobDescription & JobStatus & JobDescription & JobStatus} open MyMessage end tell [P.S. the return character after properties is a "soft-return", Opt-Return, which allows you to break an AppleScript line, while retaining it as 1 line for processing; AppleScript being a "line by line" processor. I believe it is the Open myMessage that brings the message to the front so you can see it; it is what FileMaker does not do.]
Fenton Posted December 5, 2008 Posted December 5, 2008 Just for fun. I took the above from an "either Mail or Entourage" script, which did not use that Default Email routine; but just looks to see which one is running at the time; the default being Mail. You can see in this one just how similar their AppleScript dictionaries are: tell application "FileMaker Pro Advanced" -- you'll have to match the variables to your FM fields set emailaddress to cell "designer" of current record set JobDescription to cell "JobDescription" of current record set JobStatus to cell "JobStatus" of current record set MailSubject to cell "key" of current record set EmailName to cell "creationuser" of current record end tell tell application "Finder" if name of every process contains "Microsoft Entourage" then try tell application "Microsoft Entourage" set MyMessage to make new outgoing message with properties ¬ {recipient:emailaddress, subject:MailSubject, content:JobDescription & JobStatus & JobDescription & JobStatus} open MyMessage activate end tell end try else try tell application "Mail" set new_message to make new outgoing message with properties {subject:MailSubject, visible:true} tell new_message set content of it to JobDescription & JobStatus & JobDescription & JobStatus make new to recipient at end with properties {name:EmailName, address:emailaddress} end tell end tell end try end if end tell
Julynn Posted December 8, 2008 Posted December 8, 2008 I'm having the same issue. The Send Mail script goes to Entourage but does not open a new mail window for review. I have a very limited knowledge of FMP (and am new to this forum) but tried to adapt the first script you listed. Again, it sent me to Entourage but did not open a window. Any ideas?
Fenton Posted December 8, 2008 Posted December 8, 2008 That's why I suggested the AppleScript. FileMaker cannot natively make Entourage open that new email's window. I don't know why, just a slight difference from Mail. And maybe someday in the future it will be able to; but in the meantime, AppleScript can do it.
Julynn Posted December 8, 2008 Posted December 8, 2008 Well, since I'm new at writing apple scripts and only basic knowledge of FMP, I'm not sure where I'm making my error(s). Is there anywhere that defines the FMP error codes? Specifically, #2753 and #1700?
Fenton Posted December 8, 2008 Posted December 8, 2008 http://www.troi.com/software/oserrrs.html Also, in the FileMaker Help, under functions, Get (LastError) there is a link to the FileMaker-specific errors. But the above are not in there. I believe It helps to know whether you got these during the AppleScript. In which case you should take the AppleScript out of FileMaker, put it into Script Editor (you've got this app, in your Applications/AppleScript folder). Then run it from there; it will stop when it hits the error and tell you something. Try this dead simple version (FileMaker not involved at all) set emailaddress to "[email protected]" set JobDescription to "job description" set JobStatus to "Good to go" set MailSubject to "Job" tell application "Microsoft Entourage" activate set MyMessage to make new outgoing message with properties ¬ {recipient:emailaddress, subject:MailSubject, content:JobDescription & JobStatus} open MyMessage end tell
Julynn Posted December 10, 2008 Posted December 10, 2008 Thanks for your help! I made a few adjustments and was able to get the new mail window to open in Entourage and populate with the info from FMP.
Recommended Posts
This topic is 5819 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 accountSign in
Already have an account? Sign in here.
Sign In Now