Using Applescript to Send Emails from FMP in System X

filemaker

    Next

  • 1. Calculation help
    Hi, which kind of calculation I need in order to import records from one external file (*.tab) with 3 different record category: "new" - should be added to my database "change" - should to update record already exist "delete" - should identify record ID and then delete it from my database The original records it's looks like: new,23,44,42,667,Peter,Rozen new,24,44,32,667,Sarah,Setterfield change,25,44,42,669,Sthephan,Lesler delete,26,44,32,667,Sandra,Hoppkings TIA Shai --
  • 2. Dynamic Checkbox
    Hi, I am working on a database for a book dealer. The dealer has about 20 main categories that the books can fall under and about 5 sub categories for each main one. I want to have a category checkbox section that will populate the subcategory checkbox based on which main categories have been selected (2 seperate boxes). Is this possible. Would I have two databases two store categories, one for main cats and another for subs? Any help would be greatly appreciated. THANKS!!!
  • 3. Date and Academic Season Calc?
    I'm trying to get FM to calculate the Academic Season based on a date and to sort based on season with summary headers like Summer2004, Fall 2004, in order of season and year or is it year and season?, etc; example 7/1/2004 = Summer 2004 8/1/2004 = Fall 2004 11/1/2004 = Winter 2004 1/1/2005 = Winter 2004 <--- part of 2004 3/1/2005 = Spring 2005 6/1/2005 = Summer 2005 7/1/2005 = Summer 2005 8/1/2005 = Fall 2005 11/1/2005 = Winter 2005 1/1/2006 = Winter 2005 <--- part of 2005 3/1/2006 = Spring 2006 6/1/2006 = Summer 2006 can filemaker go back 13 years and calculated the sesons? and what calcs do I need? Thanks a million.
  • 4. Displaying a graphic on active record only
    I need to show a graphic that will display only on the active record in any layout in any table - just so it only shows on the record that is active. There must be a simple way to do this but so far the solution has eluded me. What am I overlooking? Thanks for any help. Al
  • 5. Unsharp fonts in FM 7.0
    Hi, I have to upgrade our data from FM 5.5 to FM7.0. FM7.0 does convert the old files, but after opening them by FM 7.0, the graphic quality is less: de fonts are not as sharp as they are in FM 5.5. Is this normal? Is there a solution? At the first sight FM 7.0 seems to be nearely the same as the 5.5, what are the advantages? Thanks

Using Applescript to Send Emails from FMP in System X

Postby bfak » Fri, 10 Jun 2005 13:34:17 GMT

Hello,

I'm using Filemaker Pro 6 on Mac OS X (10.3.9).

I just switched from 9 to X.

I have a database called ROLODEX.  In addition to phone numbers and
addresses, it has email addresses and web pages.

I've always used scripts within FMP to go to web pages and send
emails.  I used Netscape Communicator as my emailer and Internet
Explorer as my browser.

Now that I'm in 10, I've been able to script going to a web page
(in Firefox).  However, I haven't been able to script sending an
email.  I've tried Thunderbird, Eudora and Mail.

Below is the script I used in System 9 with Netscape Communicator (the
general concept of this script doesn't work with any of the
previously listed 10 email applications).  The script is embedded in a
field, which instructs FMP to copy the email address (field name is
"E1") and then open a message in the email program with that email
address in it:

"tell application ""Macintosh HD:Applications (Mac OS
9):INTERNET:Netscape Communicator?Folder:Netscape Communicator?"
?
    OpenURL ""mailto:" & E1 & """?
    activate?
end tell"

Do you have a script that is equivalent to this that will work with
either Thunderbird, Eudora or Mail?

I'd appreciate it if someone could help on this.  I didn't want to
leave Netscape Communicator for a System 10 mail program until I got
this issue worked out.

Thanks!

Barbara


Re: Using Applescript to Send Emails from FMP in System X

Postby Spare The Spam » Fri, 22 Jul 2005 02:00:11 GMT



> ?
>     OpenURL ""mailto:" & E1 & """?
>     activate?
> end tell"

You may have grossed-out a lot of people by trying to use Applescript 
and referencing a classic application by full path name.  A simple "how 
do I open a new email message from FMP?" would surely have received an 
answer.

If that is really all you wanted to do, it's trivial. The following will 
use your preferred email program, which you can set to anything you want.

The FMP script is just "open URL" [field value E1_MailTo], where 
E1_MailTo is a FMP calculation field "mailto: " & E1

If you were actually trying to create a series of form letters, a 
natural objective when working with a database,  there are more 
efficient ways to do this.

Similar Threads:

1.Example: Send email from Perl via AppleScript using Entourage

This Perl script sends a message having a pdf attachment via Entourage
(via an IMAP email account).

Modify "ann_example" per your account.

#!/usr/bin/perl

use Mac::AppleScript qw(RunAppleScript);

# In Preferences you must set uncheck Warn before allowing an external
application to send mail
# You may have to check remember my password when you send a message
from Entourage so you don't get prompted to log in to your IMAP
server.

my $subject = "The igawk file you wanted : Test ACFD1FE";

my $content=<<EOF;
Attached is igawk.1.pdf
Enjoy
EOF

my $recipient = ' XXXX@XXXXX.COM ';

my $script=<<EOF;
tell application "Microsoft Entourage"
        activate
        set filePath to "Macintosh
HD:Users:ann_example:Documents:igawk.1.pdf"
        set msg to make new outgoing message with properties
{subject:"$subject", content:"$content", recipient: "Ann Example <
$recipient>", attachment:alias filePath, account:IMAP account
"ann_example"}
        send msg
end tell
EOF

RunAppleScript($script) or die "Didn't work!";

2.Sending email with attachment using AppleScript

Hi I have simple applescript

activate application "Microsoft Entourage"
set filepath to "Macintosh HD:Users:test:del2pdf"
tell application "Microsoft Entourage"
set newMessage to make new draft window
make new attachment at newMessage with properties {file:filepath}
end tell

It works just fine when I call it directly from the script editor.
However I need to execute this script from my application , therefore
I use Carbon framework (see code snippet at the end)
In this case some strange thing happens : sometimes new email message
is created with attachment but attached file has been deleted and when
I click send I got error indicating non-existent attachment file.
Wht;s even more strange that sometimes file is not deleted and sending
is successful.
 I double checked my code and I do NOT delete attachment file  it
feels like Entourage deletes it before sending email.
Can anybody help with this issue ? Any ideas?

Thanks
David





OSStatus LowRunAppleScript(const void* text, long textLength,
                                  AEDesc *resultData) {
    ComponentInstance theComponent;
    AEDesc scriptTextDesc;
    OSStatus err;
    OSAID scriptID, resultID;

    /* set up locals to a known state */
    theComponent = NULL;
    AECreateDesc(typeNull, NULL, 0, &scriptTextDesc);
    scriptID = kOSANullScript;
    resultID = kOSANullScript;

    /* open the scripting component */
    theComponent = OpenDefaultComponent(kOSAComponentType,
                                        typeAppleScript);
    if (theComponent == NULL) { err = paramErr; goto bail; }

    /* put the script text into an aedesc */
    err = AECreateDesc(typeChar, text, textLength, &scriptTextDesc);
    if (err != noErr) goto bail;

    /* compile the script */
    err = OSACompile(theComponent, &scriptTextDesc,
                     kOSAModeNull, &scriptID);
    if (err != noErr) goto bail;

    /* run the script */
    err = OSAExecute(theComponent, scriptID, kOSANullScript,
                     kOSAModeNull, &resultID);

    /* collect the results - if any */
    if (resultData != NULL) {
        AECreateDesc(typeNull, NULL, 0, resultData);
        if (err == errOSAScriptError) {
            OSAScriptError(theComponent, kOSAErrorMessage,
                           typeChar, resultData);
        } else if (err == noErr && resultID != kOSANullScript) {
            OSADisplay(theComponent, resultID, typeChar,
                       kOSAModeNull, resultData);
        }
    }


    bail:
    AEDisposeDesc(&scriptTextDesc);
    if (scriptID != kOSANullScript) OSADispose(theComponent,
scriptID);
    if (resultID != kOSANullScript) OSADispose(theComponent,
resultID);
    if (theComponent != NULL) CloseComponent(theComponent);
    return err;
}

3.Send email from FMP through MS Outlook

FMP 8.02, WIN XP

When we try to send an email from FMP, MS Outlook give us a warning, saying
that,

"A program is automatically try to send an email on your behalf. Do you want
to allow this?"

I assume this is to catch viruses trying to propagate themselves, but it
adds an unnecessary step in our process.

Is there any way to configure Outlook to accept email requests without
question from our FMP file?

Thanks,

Scott C.

4.Can an applescript count open fmp databases?

I am trying to tell filemaker to close all window (databases) but the
front one running this applescript. I cant seem to get the applescript
to properly count the number of open databases. Anyone have a
suggestion.

This is what I have.

tell application "FileMaker Developer"
	activate
	repeat until (count of windows) = 1
		close window 2
	end repeat
end tell

Thanks.
Jon Lanclos
 XXXX@XXXXX.COM 
The Discovery Group Inc.

5.Problem with Applescript on FMP 6 & OSX

I recently switched to OSX 10.3 and am now having problems with my
Applescripts - where I previously was able to use a script to copy text from
Filemaker Pro and paste it into MS Word, I now get one of two messages...

1. The variable paste is not defined (Error -2753) OR
2. Microsoft Word got an error: can continue <event MSWDactv> (Error
?708)

My applescripts looks like this:

tell application "Finder"
    activate
    select file "e-Letterhead.doc"
    open selection
end tell
tell application "Microsoft Word"
  paste
end tell

AND

tell application "Finder"
    activate
    select file "e-Letterhead.doc"
    open selection
end tell
tell application "Microsoft Word"
    activate
    do Visual Basic "Selection.MoveDown Unit:=wdScreen, Count:=1"
    do Visual Basic "Selection.EndKey Unit:=wdLine"
    paste clipboard
end tell

It also seems to have screwed up for those using it on OS 9.2...

Ie run out of options at the Apple and Filemaker sites... So any help
would be greatly appreciated!

Thanks!
------------------------------------
Debra Clinton
Cambridge Management Planning Inc.
Tel. 416-484-8408  Fax: 416-484-0151
< XXXX@XXXXX.COM >
------------------------------------

6. Applescript as subscript of FMP script

7. FMP 5.5-Applescript Timeout error

8. Unable to send email using "Send As"



Return to filemaker

 

Who is online

Users browsing this forum: No registered users and 68 guest