AnsweredAssumed Answered

ActiveX can't Identify document names when hosted

Question asked by Jbsherry on Dec 5, 2011
Latest reply on Dec 6, 2011 by Jbsherry


I'm working on a project that requires activex with FMP 11 and FMS11. Mycode checks to see if a file is open, and executes a script if it is. The problem is it works only if the file is open locally, not from fms.


FMApp = GetObject("", "FMPRO.Application")

FMDocs = FMApp.Documents

FMApp.Visible = True

If (FMDocs Is Nothing Or FMDocs.Count = 0) Then

MsgBox("The Filemaker Pro database must be opened first.")




' go find our target file

For Each fmDoc In FMDocs

If InStr(LCase(fmDoc.fullname), LCase("ExecuteScanScript.fp7")) > 0 Then

' this is our file, run the script

fmDoc.dofmscript("Execute Scan Script")

End If




I'm testing for the existence of a document, and the test succeeds when the file is open locally, but fails when hosted. I've tried a few obvious variations, and tried to grok the list of open documents, so I could see what string to test for, but I'm very new to and failed at this last task.


So, it works with a local file that runs the script in the hosted file, but I'd really rather access the hosted file directly if possible. Any suggestions would be appreciated.