Jump to content
Server Maintenance This Week. ×

Links to Word Docs in Mac


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

Recommended Posts

The aim is to have a button which will automatically open a Word document associated with a record in a FMP file.

In windows, it is easy - you can use the Insert-Object menu to either embed the word doc in the datbase or create a link - both options can then show the word doc as an icon in a container field.

BUT - this option is not available in Mac.

So far, this is how I have done it but it seems quite "inelegant" to me, especially because it requires the user to manually insert a full file path name.

Fields you need in your database:

. A text field called "FilePathText"

Scripts you need:

. A one step script to open the word document associated with the record

The script step is:

. Send Apple Event["Microsoft Word","aevt","odoc"]

To set it up like that you:

. Select the Send Apple Event step

. Click on "Specify"

. Select "open document" from the "send the xxx event with" section

. Click on the Field Value button and specify the "FilePathText" field

. Check the "Bring target application to foreground" box

. Check the "Wait for event completion before continuing" box

. Click on "Specify Application" and cycle through the folders until you get to the Microsoft Word application, select it and click on "Open".

Now, in the "File Path Text" field in your database records, type the full path name of the field from the hard disk down to the file name, for example: "RussLap 6G:Filemaker Tests:Forum Questions:WordLink:TestDocNumber2"

. Create a button called "Open Word Doc" and assign the script to it.

Is there an easier way? I find it hard to believe that something would actually be easier in Windows!

Russ Baker

Canberra, Australia

The Land of TWOGM

Link to comment
Share on other sites

This is totally doable with AppleScript.

First of all, how is the "document assiciated with a record"?

If the file's path isn't already in a field in FileMaker, here's what I would do:

code:


Perform AppleScript[

set myFile to choose file

tell application "Finder" to open myFile

]

This code will bring the user to a open file dialog box where they can select whatever file they want. It will then open the file with the default application for that file (as if you had double clicked it in the Finder).

BTW, the command could also be tell application "Finder" to open (choose file), but this requires that the Finder first be brought to the front. That's why I put the file reference in a variable and then open the variable.

I'm not positive that this is exactly what you want, but if it isn't then what you do want is almost certainly possible with AppleScript.

Chuck

[ March 17, 2002, 11:23 PM: Message edited by: Chuck ]

Link to comment
Share on other sites

Chuck,

Lets say we're dealing with a real estate situation and the basic file record has the details of the property etc.

Now, as part of the record we might want to include an existing Word doc which is a full list of the property features, another word doc which is the standard contract complete with the sellers special conditions and a pdf of a map of the area.

When the database is set up for the users, we want to have these relevant files associated with the correct record. Ultimately, we want the user to be able to click on the following buttons:

. Open Features

. Open Contract

. Show Map

and have the appropriate file open in its parent application.

Like I said, this is easy to do in windows, but a Mac solution is required in this case. The procedure I put in the original post will achieve this on a Mac - but it just seems a bit clunky to me. I was wondering if its possible to do it better?

Russ Baker

Canberra, Australia

Link to comment
Share on other sites

Why not do *everything* in FMP. There is nothing better than a single-application system.

My first ever in-house admin system used FMP to store the data, which was exported to Pagemaker to create flyers. The flyers looked great but the users needed to know FMP *and* Pagemaker to do their work. Then the new version of PM came out and the templates needed to be redone, users re-trained... <sigh>

The newxt version of the admin system did the flyers as a FMP layout. No, the un-kerned text didn't look quite as sophisticated but it became a one-click solution. A thirty minute job reduced to 30 seconds.

Link to comment
Share on other sites

Russ,

Like I said, you can do this with AppleScript. If you need to have the user's pick the file you can use the script I gave above. If the path to the file is known (or can be calculated, such as it's in the folder X123, which is in the folder that this FileMaker file is in) you can use an AppleScript like this:

code:


tell application "FileMaker Pro" to set theFile to cell "FeaturesDocPath" of current record

tell application "Finder" to open file theFile

Is the problem that FileMaker doesn't know where the file is? Can it be calculated? For instance, if you have a file called Properties.fp5, and the files for record ID PRP123 is in a folder called "PRP123" that's in the same folder as "Properties.fp5", then you can use a status function to get the path of Properties.fp5 and use that to calculate the path to the document for the current record.

Let me know if this helps.

Chuck

Link to comment
Share on other sites

Tom,

Create a container field and then go to the Insert-Object menu, click on Browse, select the Word file and choose the "show as Icon" option.

You can either embed the word doc in Filemaker itself, or just have a link to the original.

The word document will now show as a Word Icon in the container field. Selecting the field and then double-clicking on it will open it in word and you can print it. Both the inserting and opening processes are scriptable if you want to but I'm at home on the Mac right now and all the PCs are at work so I can't give you the exact steps.

In addition to Word docs, I also use this a lot for embedding blank Excel spreadsheets if I'm creating a system where data will be imported from XL. That way, I at least have a chance that users will use a spreadsheet with the correct column order, formatting etc.

Russ Baker

Canberra, Australia

Link to comment
Share on other sites

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