Hi Brian, This looks like exactly what I need. I don't need attachments. Saving as PDF would be ideal but they also said they would settle for plain text receipt. That' a great idea on the link for download. I never even thought of that and it makes it much simpler. Thank you much for your help. ~ steve On Apr 19, 2009, at 2:06 PM, Brian Stevens wrote: > > On Apr 19, 2009, at 8:30 AM, Steve wrote: > >> A customer of mine is requesting that our point-of-sale application >> save a receipt as a PDF then email it to the customer. >> >> While I know how to do this in a couple of steps, it is far from an >> automatic process. >> >> Can this process be done in AppleScript or automated in FB4.4 ? > > > Steve, > > For email: > > The example "LaunchMailPressSend" in the AppleScript folder of FB5 > examples shows one way to send an email but has limitations as > written ( by me - sorry ). > > (1) It doesn't do attachments and more code would need to be written > to do this > > (2) It is specifically written to drive the Apple Mail app. It could > be adapted for other mail clients but there is no smarts in this > demo for figuring out what mail client is being used. > (3) Access for Assistive Devices must be turned on ( and the code > checks for this ) but I've had zero complaints since it is simple to > turn on in System Preferences > > The demo was built for a specific need after encountering too many > potential roadblocks with the unix sendmail command. Once the code > bypasses a mail client( as the unix command does ), it must deal > with SMTP servers, permissions from ISPs and various other non- > trivial hurdles. There are examples of using sendmail but none > address the preceding hurdles because it is going to be different > for each ISP and Mac. > > One other thought: many ISPs strip off attachments greater than a > certain size ( and some are as small as a couple of megs ), so in my > own world I've been sending clients a link to a pdf file they can > download. This bypasses the entire email hassle ( because they > download via an http link in a web browser ). I would expect a > receipt file to be small, so this shouldn't be an issue but just a > thought. > > For PDFs: > > The example, QD and CG -> pdf, in the Graphics/CoreGraphics (Quartz) > folder of FB5 examples shows how to generate a PDF from QuickDraw or > Coregraphics commands under program control ( assume this is needed > vs. using the print dialog to allow the user to create a pdf file ) > > It sounds to me like the email code could work for you and your > clients if they are willing to use Apple's Mail. The only remaining > task would be to write AppleScript to attach the PDF file to the > email. You could also write an automator action to retrieve the pdf > file and attach it to the email. Maybe a way to do this is always > save the pdf file by the same name ( so you can hard code the path > and name in automator - maybe put files in useriD/Library/ > Application Support/Some Folder for this purpose ). After sending > the email, the program code would rename the pdf file to some > meaningful name ( clientxxxx04_18_2009Tran1234567 etc. ) allowing > the next receipt file to use the same hardcode name. That was all > OTTOMH, so it undoubtedly can be improved upon. > > HTH---good luck Steve. > > Brian S. > > -- > To unsubscribe, send ANY message to: futurebasic-unsubscribe@... >