March 2, 200520 yr 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
March 7, 200520 yr 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
March 7, 200520 yr 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"
March 7, 200520 yr 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?
March 10, 200520 yr 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?
March 10, 200520 yr 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?
March 10, 200520 yr 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?
March 21, 200520 yr 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"
March 21, 200520 yr 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"
March 31, 200520 yr 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
April 2, 200520 yr 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
April 10, 200520 yr 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)?
April 11, 200520 yr I tried using the script above described by artypants but when I run it from FM7 I get a message from FM: Expected "end" or "end tell" but found "
April 11, 200520 yr The problem is that if you mix FileMaker calculation comments in with AppleScript text, you want the AppleScript text to be inside quotes, but the comments not. They got mixed up in the last few lines. The
April 11, 200520 yr 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.
April 12, 200520 yr 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 ...
April 12, 200520 yr 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).
April 12, 200520 yr 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,
Create an account or sign in to comment