New Xojo developer, but an advanced user of FileMaker. Trying communicate from Xojo to FileMaker using ActiveX.
The code example in ActiveX was created for Visual Basic:
Dim FMProApp As FMPro70Lib.Application
Set FMProApp = CreateObject(“FMPRO.Application”)
Set FMProApp = GetObject(, “FMPRO.Application”)
Dim FMProDocs, FMProDocs.Open(“c:\MyFile.fmp12”,"","")
Set FMProDoc = nothing
The compiler gives me errors on the first "Set FMProApp = CreateObject(“FMPRO.Application”)
How can I find information about converting this code to Xojo?
Thanks in advance…
Hi Nelson! It’s great to see fellow developers from the FileMaker world here.
I don’t know how to help you with ActiveX, but you could do something very similar with FileMaker XML web publishing if your file is hosted on FileMaker Server.
Calling the following URL will cause a FileMaker Script to run on the FileMaker Server where the field data on the RETURNLAYOUTNAME layout will be returned.
In a Xojo Web app, you can make the call like this:
Dim http As New HTTPSocket
I hope this helps!
Excellent, I will give it a try…
OLEObject seems like it might be an option as well. More information here:
ActiveX, COM and OLE
Hi Paul and thanks.
Does it mean that you need to attach the OLE object to be able to access the ActiveX control?
One way is to manually create an OLEObject. Another way is to create an ActiveX using the menu option. I’m not really FM ActiveX/OLE to know which would be the better choice for your situation.
I’d use their ODBC driver. You can access the data in the Filemaker tables through SQL queries.
Even though calling a URL or using ODBC sound like excellent approach to manage FileMaker using Xojo, in the case of using ActiveX, you can call scripts with or without FileMaker Server. Actually the projected application requires for FileMaker Pro to be installed on the computer. If there is anyone that can provide light on using FileMaker ActiveX with Xojo, will be greatly appreciated. Thanks…
You can create a VB Script to run scripts. It may or may not be an option for you.
Dim fmApp, fmDocs, fmDoc, SH
Dim theFile, theScript
theFile = "NameOfFileMakerDB"
theScript = "NameOfScript"
Set fmApp = CreateObject("FMPro.Application")
fmApp.Visible = True
Set SH = CreateObject("wscript.shell")
SH.AppActivate FMapp.Caption, True
Set fmDocs = fmApp.Documents
For Each fmDoc In fmDocs
If InStr(LCase(fmDoc.fullname), LCase(thefile)) > 0 Then
Set SH = Nothing
Set fmDoc = Nothing
Set fmDocs = Nothing
Set fmApp = Nothing
Thanks Peter. Do you happen to know how to write this same script in Xojo?
You create the script as a text file and use Folderitem.Launch to run it within your Xojo app. FileMaker must be running and the “database document” loaded.
Dim f as folderitem = SpecialFolder.ApplicationData.Child(“VBS”).Child(“myScriptName”)
if f <> nil and f.exists then
Another approach if you don’t want the scripts on the user disk is to create constants for the scripts. You can then create a temp file from the constant, launch it and then delete it.