Help

Table Of Contents
Creating scripts to automate tasks
F
ILEMAKER PRO HELP 432
Reference counts and releasing an object
When an automation object is referenced, a reference count increments to let FileMaker know that a
process is using that object. In Visual Basic, an object is reference counted every time you set the
declared variable to a FileMaker object, for example:
' just a declaration - no references yet
Dim FMDocs as FMPro70Lib.Documents
' this line causes a reference of FileMaker's "Documents" object
Set FMDocs = FMApp.Documents
' this causes a second reference of the same FileMaker "Documents" object
Set FMDocs2 = FMApp.Documents
FileMaker may not exit until all reference counts are released. In Visual Basic, you can release the
reference count by setting the object variable to "Nothing", for example:
' releases the reference to the FileMaker "Documents" object
Set FMDocs = Nothing
' releases the 2nd reference to the FileMaker "Documents" object
Set FMDocs2 = Nothing
' releases the reference to the FileMaker Application object
Set FMApp = Nothing
It is good practice to always set object variables to "Nothing" when you have finished using the
variables.
Access Privileges
FileMaker Pro uses the Documents.Open(filename As String, accountName As
String, password As String
) method. If the accountName and password arguments are
empty strings, the file will be opened as a client user.
Scripts
FileMaker Pro scripts called directly by Automation may interrupt each other.
FileMaker Pro scripts called from within other FileMaker Pro scripts will run in order, as expected.
Remotely hosted files
It is not possible to open a hosted file using ActiveX Automation alone. To open a hosted file using
Automation, you can either open the hosted file directly using the FileMaker Open dialog box, and
then access the file using Automation, or you can write a FileMaker
Pro script that opens the hosted
file, and then call that script via Automation.
Related topics
Using FileMaker Pro ActiveX Automation (Windows)
ActiveX Automation example (Windows)
ActiveX Automation objects, methods, and properties (Windows)
FileMaker Pro supports three Automation Objects: Application, Documents, and Document. The
following are methods and properties available for the objects.