Jump to content

Entering fields from a single FM record into Word


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

Recommended Posts

I have a form letter that I frequently send.

 

Presently, I click a button on Filemaker and it opens the form letter.

 

Then I have to manually put in the address and client information.  I believe this process could be automated, as it is also stored on Filemaker.

 

I don't want to do a "merge" and would rather accomplish this with applescript.  The reason for this is because I don't want to have to do a "search" to limit my records, rather I want to just be "inside" that particular record - click the associated button I have that opens the document in word, and have it "find and replace".

 

I have tried this:

 

set thematter to cell "Mattername"

 

tell application "Microsoft Word"

set findRange to find object of selection
tell findRange
execute find find text "Matter" replace with thematter replace replace all
end tell
end tell 

 

Yet this has two problems:

 

1. It doesn't pull the data from the current record.  It just pulls the data from "a" record.

2. It doesn't work with linked table records.

 

For example, I have two tables.  One that lists all the cases and one that lists all the clients.  A client can have multiple cases, but a case only one client.  The "current record" that I would be performing this task from would be in a case record.  The problem with the above mechanism is that it does not seem to work when I attempt to grab client data itself.

 

Any suggestions that can solve these issues?

Link to comment
Share on other sites

Maybe I don't understand your explanation.  But it seems to me the easiest would be to create a layout in a Customers table that is the frequently sent letter, and put in merge fields.  Then on the customer layout, you could put a button (or in a custom menu) that would script a go to that layout, you would be on the same record, and print.  You could also do this for a found set

Link to comment
Share on other sites

I have tried this:

 

set thematter to cell "Mattername"

...

 

It just pulls the data from "a" record

 

No, it does not "just pull the data from "a" record"; it gets the value from the first record of the current found set. If you want the value from the current record, you must say so:

set thematter to cell "Mattername" of current record

Similarly, to get the client data (from the context of Cases) you can say:

cell "Clients::SomeField" of current record

 to refer to the data from the first (in this case, the only) related record in Clients.

 

 

---

This, BTW, is an AppleScript question; we have a sub-forum for that:

http://fmforums.com/forum/forum/29-applescript-automator/

Link to comment
Share on other sites

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