Re: Mail script broken by Tiger
Re: Mail script broken by Tiger
- Subject: Re: Mail script broken by Tiger
- From: "Gary (Lists)" <email@hidden>
- Date: Mon, 08 Aug 2005 14:56:29 -0400
"John McKee" wrote:
> set AppleScript's text item delimiters to " " -- now a single return to break
> down free form text to individual lines
John,
All that I saw that was a yellow flag was the above line.
In the other similar lines, where you set the TIDs to a sequence of returns,
the script compiles to actual returns (white space). The line shown here,
from the last 'try...' block in your script, does not do that (in your
pasted copy), so I am wondering if you have a _space_ there and not a
return?
However...
Your approach (which I know you said you were using in Panther, which
probably means you're fine with it), while it work(s)(ed) for your form, is
bound to _that_ form. You would need more scripts, with different 'web
field' names and so on to handle another form. Also, if a web form changes,
then you'll need to edit every copy of the script to match.
A better approach, IMO, is to write a simple AppleScript (rule-fired is
fine) that will send any captured web form submission to the proper
FileMaker database for that form, and nothing more.
Along the lines of...
-- 'pseudo code'
--
-- talking to your Email client...
set msgBody to -- the contents of your Mail message
--
tell app "FileMaker Pro"
tell database 1 -- target the correct DB here, however you'd like
-- get your data into a new rec
make new record at end of records of layout 0 with {"",msgBody,""}
end tell
end tell
That's it. Your script only needs to get the Mail msg content, then target
the correct DB (any one) and make a new record with only one field being
filled in -- the main submission result.
You then let FileMaker do the separation of content, which is faster than
AppleScript doing the same thing. From 1998 to 2001, I sold a whole
boat-load of copies of a small FM tool called 'Web Form Decoder'.
At the time, there were not a lot of options out there, and folks who
received web forms by mail wanted to get that data into FileMaker,
naturally.
Well, the tool is now totally free (and totally unlocked) and has been for a
couple of years. It is set up to process up to 45 web form fields, but can
easily be expanded to FileMaker's maximum field count, which is somewhere
around 10,000 I think.
I don't have the file on my website any longer (because the number of tools
to do this has expanded, and because I use FileMaker less these days), but I
have a copy that I send out. I am happy to send you (or anyone else) a
copy, but will also demonstrate the _very simple_ concept right here.
Roll Your Own FileMaker Web Form Decoder
=========================================
GIVEN: Web Form Submission results which look like:
First Name: Bob
Last Name: Roberts
Occupation: Politician and right-wing folk guitarist.
1. Let there be a FileMaker Text type field named "Form Submission"
This will hold the entire (email) submission of the form, just
like what you are acting on in your AppleScript as the msg 'body'
2. Let there be a FileMaker Text type field named "formLabel01"
You will put here the _exact_ web form field label _as returned_ in the
form's submitted results for the first label
Ex: "First Name: " -- note the final space after colon, which is
part of the whole label
-- this field CONTENT is equivalent
to your AppleScript 'text item delimiter'
3. Let there be a FileMaker Calculation type field named "First Name"
And here is all the work...insert this calculation into the definition for
the 'First Name' field (which is named 'formLabel01' or whatever you want):
If(PatternCount(Form Submission, formLabel01) < 1,
"",
If(IsEmpty(formLabel01),"",Middle(Form Submission, Position(Form
Submission,formLabel01, 0, 1)+Length(formLabel01), Position(Form Submission,
"ΒΆ", Position(Form Submission,formLabel01, 0, 1), 1)-(Position(Form
Submission,formLabel01, 0, 1)+Length(formLabel01))))
)
=========================================
You just copy this calculation into each data field, being sure to change
the name of the 'formLabel01' to the name of the actual field holding the
field's form label, as it shows in the mailed results.
So, for each "form field", you will have 2 FM fields. The first will hold
the content which is the entire 'form label' from the submission results.
The second will be the actual content submitted in the form, and the field
will be a calculation.
This is so easy, you will wonder why you didn't do this always. We've used
the 'Web Form Decoder' FileMaker file as a template in many projects. It
has been used as a stand-alone "submission grabber" as well as a web-based
tool, and does quite well with very large (long) form submissions.
Again, you can employ the technique in a few minutes from what I have given
you, or if you prefer, I can email you a stuffed copy of the original
distribution, which has some more explanatory notes and such.
I hope this is useful, in some way.
--
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden