September 9, 200421 yr Newbies 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 ?
September 10, 200421 yr 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 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
September 13, 200421 yr 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
Create an account or sign in to comment