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

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

Recommended Posts

Posted (edited)

I am setting up a script to parse information from certain emails so that in can create new records in a database, and I am almost there but for some reason that I cannot fathom Filemaker overwrites the information in the first record of the database rather than putting it into the new record that the script creates. Would anyone know where I am going wrong. Here's the script

tell application "Mail"

set the_message to item 1 of (get selection)

set message_text to content of the_message as string

set nom_list to paragraph 4 of message_text

set nom_list to items of nom_list

count items of nom_list

copy result to total_nom

set nom to items 7 thru total_nom of nom_list as string

set prenom_list to paragraph 5 of message_text

set prenom_list to items of prenom_list

count items of prenom_list

copy result to total_prenom

set prenom to items 10 thru total_prenom of prenom_list as string

set adresse_list to paragraph 6 of message_text

set adresse_list to items of adresse_list

count items of adresse_list

copy result to total_adresse

set adresse to items 11 thru total_adresse of adresse_list as string

set nlp_list to paragraph 7 of message_text

set nlp_list to items of nlp_list

count items of nlp_list

copy result to total_nlp

set nlp to items 7 thru total_nlp of nlp_list as string

set ville_list to paragraph 8 of message_text

set ville_list to items of ville_list

count items of ville_list

copy result to total_ville

set ville to items 12 thru total_ville of ville_list as string

set telephone_list to paragraph 9 of message_text

set telephone_list to items of telephone_list

count items of telephone_list

copy result to total_telephone

set telephone to items 13 thru total_telephone of telephone_list as string

set email_list to paragraph 10 of message_text

set email_list to items of email_list

count items of email_list

copy result to total_email

set email to items 12 thru total_email of email_list as string

end tell

tell application "FileMaker Pro"

activate

open file "Bruce:Users:geoffreydyson:Documents:Krakatoa:fichiers FM5:adresses"

create record

go to last record

set cell "nom" to nom

set cell "prénom" to prenom

set cell "adresse" to adresse

set cell "nlp" to nlp

set cell "ville" to ville

set cell "téléphone_1" to telephone

set cell "email" to email

set cell "pays" to "Suisse"

set cell "sexe" to "m unfamiliar"

end tell

Edited by Guest
Posted

AppleScript has a slightly different idea of focus than FileMaker, which has puzzled me also. Even though you're "on" the last record, the "set cell" commands are still setting values into the 1st record. You need "current record". It could be added to each field:

set cell "nom" of current record to nom

But less tedious is to surround them all with:

tell current record

set cell "nom" to nom

set cell "prénom" to prenom

etc.

end tell

This topic is 6941 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.