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

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

Recommended Posts

  • Newbies
Posted

I'm looking for a script to automatically open a word document.

Every record needs to open a different word document, but the documents are all in the same place.

Any suggestion ?

Posted

Hi,

The script below is based on the assumption that your documents are stored in the same folder as your filemaker file. It's overkill as I realized afterwards that this is more likely to NOT be the case.

It might help someone one day though crazy.gif

Based on it, You should easily find your way assuming (again) that each document name is stored in a field called 'DocumentName' on each record, and that you know the path to the folder.

If [Abs(Get(CurrentPlatform))>1]

SetField[g_docFilePath;"file"&Middle(Get(CurrentFilePath);Position(Get(CurrentFilePath);":";1;1);

Position(Get(CurrentFilePath);"/";1;PatternCount(Get(CurrentFilePath);"/"))-Position(Get(CurrentFilePath);":";1;1)+1) & DocumentName & ".doc"]

OpenUrl [g_docFilePath-no dialog]

Else

SetField[g_docFilePath;"file://"&Middle(Get(CurrentFilePath);

Position(Get(CurrentFilePath);"/";

Position(Get(CurrentFilePath);":";1;1)+2+(Get(CurrentPlatform)=-1);1);

Position(Get(CurrentFilePath);"/";1;PatternCount(Get(CurrentFilePath);"/"))

-

Position(Get(CurrentFilePath);"/";

Position(Get(CurrentFilePath);":";1;1)+2+(Get(CurrentPlatform)=-1);1)+1) & DocumentName & ".doc"]

OpenUrl [g_docFilePath-no dialog]

End If

Posted

Hi Ugo,

that's complicated. and cross-platform. but here's AppleScript: ;-)

set mypath to (path to documents folder) as string

set mypath to mypath & "word docs:"

tell application "FileMaker Developer"

tell document 1

tell current record

set docname to cell 1

set fullpath to mypath & (docname as string)

tell application "Microsoft Word"

try

open alias fullpath

on error

display dialog "doc not found!"

end try

end tell

end tell

end tell

end tell

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