Jump to content
Server Maintenance This Week. ×

open ms word document from a field


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

Recommended Posts

  • Newbies

Hi

I would like to open a ms word document with a script using a field to define the document address. I can open the word application and define a specific file for that script using send event, but not for a field. I am sure this an easy and common task to peform.

Any help would be greatly appreciated,

Alex

Link to comment
Share on other sites

It seems to me that 'send event' isn't even necessary. When you define a container field, and insert the word doc as a file with only the reference (or if you wish the doc itself), then you can approach that field in a script with 'go to field'. Make sure the 'select/perform' option is checked.

When you use the go to field script step, the document will open in Word... simple as that.

Harryk

Link to comment
Share on other sites

If this is on a Mac, and the "document address" is a full Mac file path (field "Filepath" below), you could use the Perform AppleScript step, either passing the file path to the AppleScript, or using a calculation, such as:

"tell app "Finder"

Link to comment
Share on other sites

Can there be other complications with this script steps?

I've done exactly as you have explained above but I'm experiencing some problems. The first time the document is opened but then the script only works occasionelly. Sometimes the screen flashes as if a document is being opened but then nothing happens.......

Has anyone experienced the same thing?

Link to comment
Share on other sites

I, too, am looking for a solution that works when the container contains the file. The "Go to field" script step does not work on a mac and the applescript thing does not work if the file name needs to change (ie, if you want multiple word docs open at once it gives an error at file #2). Is there a way to export the field with a calculated file name and send an applescript command to MS Word to open up the specific file?

Link to comment
Share on other sites

I, too, am looking for a solution that works when the container contains the file. The "Go to field" script step does not work on a mac and the applescript thing does not work if the file name needs to change (ie, if you want multiple word docs open at once it gives an error at file #2). Is there a way to export the field with a calculated file name and send an applescript command to MS Word to open up the specific file?

Link to comment
Share on other sites

I, too, am looking for a solution that works when the container contains the file. The "Go to field" script step does not work on a mac and the applescript thing does not work if the file name needs to change (ie, if you want multiple word docs open at once it gives an error at file #2). Is there a way to export the field with a calculated file name and send an applescript command to MS Word to open up the specific file?

Link to comment
Share on other sites

  • 2 weeks later...

The only solution I've been able to come up with to open multiple files is to store only a reference in the container field and then have a scriptmaker Perform AppleScript step that does this:

// tell finder to open an alias of the file using the default application

"tell app "Finder"

Link to comment
Share on other sites

The only solution I've been able to come up with to open multiple files is to store only a reference in the container field and then have a scriptmaker Perform AppleScript step that does this:

// tell finder to open an alias of the file using the default application

"tell app "Finder"

Link to comment
Share on other sites

  • 2 weeks later...
  • Newbies

Yes, I am having teh same problem. When I put the document (letter.doc) in the container field (letterbox) and use the script Go To Field[select/perform; Person::letterbox], nothing happens! I tried replacing the letter.doc with the winword.exe file but again nothing happens. There seems to be some vital step missing here. Any suggestions? I have also tried to set up a DDE link with the servicename winword, Topic, and letter.doc but having spent most a a full day trawling the internet I cannot find anywhere that tells you what to put in as the Topic . I note that the open URL script has the Topic www_openURL but what is the equivalent to open Word or a document in Word. The end result I want to achieve is very very simple. I want teh end user to pull up a contact name and address and use that name and address in a Word document to send the contact a letter. Pretty basic really. Using teh Copy Record and Paste within Word I have a solution of sorts but there must be a more elegant solution. Any suggestions would be most gratefully received.

John Donald

from Bonnie Scotland

Link to comment
Share on other sites

I'm not sure why people are having problems with this. In my Mac solution I have a client file and a letters file. I store letters (Word documents) I have written re clients using a container field in the letters file to store a reference to the relevant document together with a field with the clients ID and another with the date of the letter.

I access the letters using a portal from within the clients file. The fields in the portal are the container field and the date field. The portal shows a list of the documents as Word icons+filenames and the creation dates. Double clicking (left) on the Word icon opens the letter very promptly. There is no scripting and its very simple.

It is however a little tedious to create the Letters database manually.

I would much appreciate some assistance with the Applescript syntax for automating the creation of new records in the Letters file. Using the Applescript command to "create new record" then set the cell "Fieldname" to ... is fine for simple numeric and date fields but appears inadequate when I'm trying to create a container field. Ive tried storing the complete pathname of the word document and variations of this - so far with no success.

tell application "FileMaker Pro"

tell database "Letters"

create new record

set cell "Lett_Cl_ID_FK" to Cl_code

set cell "Lett_path" to ("File_path") as alias

end tell

end tell

creates an error message pertaining to the container field.

Does anyone know the syntax?

Many thanks

SB

Link to comment
Share on other sites

Clearly I am missing something in this thread. I have created a portal in the main layout which contains two columns .. a description field and a container field.

I have inserted various documents into the container field (jpg, word doc, pdf and excel spreadsheet) but when I double click on them nothing happens.

I have a separate question (on the assumption that I can get this working eventually)

Since it appears that this functionality is platform dependent, how can I program it to determine which platform it is being executed on and making appropriate changes (i.e. performing AppleScripts or plug-ins)?

Link to comment
Share on other sites

I've changed the script as you recommended and it now works enough to pick up the file name from the document. But it doesn't find it, I guess because the file path is not stored in the container. A bit more learning to do ... but thanks a lot for the tips.

Link to comment
Share on other sites

Still not working ... I changed my insert into the container to just specify a reference to the file, but even though the message I get includes what appears to be the correct path to the document, I get a message that it cannot find the file with Unknown error -43 at the end.

But this is progress ...

Link to comment
Share on other sites

Well, it certainly can't find a document that isn't there; I guess you got that. Why don't you put the AppleScript calculation field on the current layout so you can see it and see if it looks right. AppleScript needs that field to be on the layout, unless you include a "layout" reference where it is. Maybe that's what's wrong.

For that matter, if this is a file inserted as a reference, you should be able to double-click on the container field to open the original file, if it is enterable; otherwise create and attach a script to go to the field, with select (it has to be a script; not just a Go to Field button).

Link to comment
Share on other sites

Quite possibly I got it wrong. This is my first attempt to use AppleScript in FM, and I'm just learning FM too. I'm not even sure I understand the distinction you are making above. I used the AppleScript calculation by calling it from a FM Script.

But following your suggestion, I removed the FM Script and double clicked it. (It did open them ... both a pdf file and a jpeg file.) Before (when I was including the file and not just the reference to it) when I double clicked on the document nothing happened and reading in this forum I thought that the solution was to use AppleScript.

I'm doing this work to be deployed on a Windows machine. I presume that double clicking will also work on Windows.

Thanks for the assistance,

Link to comment
Share on other sites

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