Newbies fossie Posted September 9, 2004 Newbies Posted September 9, 2004 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 ?
Ugo DI LUCA Posted September 10, 2004 Posted September 10, 2004 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
cjaeger Posted September 13, 2004 Posted September 13, 2004 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now