5 Replies Latest reply on Sep 1, 2012 10:28 AM by klein

    FM11 ActiveX Automation With C++

    klein

      Title

      FM11 ActiveX Automation With C++

      Post

      Dear forum

      Can anybody provide me with some sample project (or even a manual) of how to automate Filemaker via MS Visual C++ or preferably Borland C++-Builder 6.0?

      I've spent quite a few hours on this now and have been partly successful, i.e. I'm able to launch a specific FM-DB or quit/set visibility of FM application. However, I still couldn't manage to run a script from a DB or do other actions on document level.

      Any help is very much appreciated, thank you very much!

      PS: I'd also be interested in a VBScript example that runs a FM script, if this is possible in VBS at all.. It would help me to figure out, whether my C++ code is bad or rather something with the activeX registration or the FM db.

      Used software:
      Win XP Pro SP3
      FM Pro Advanced 11 v3
      Borland C++-Builder v6

        • 1. Re: FM11 ActiveX Automation With C++
          Sorbsbuster

          You haven't said what you want to achieve with all of this, but if you want to use VBS to grab a hook into a Filemaker file and drive a script, then the easiest way is to have a 'Trigger Script' FM file which has no fields, no data, nothing, except one script.  That script is to run an external script you nominate in the 'real' destination file.  Its second step is to close itself down.

          All you have to do, then, in VBS is to open that Trigger File.

          • 2. Re: FM11 ActiveX Automation With C++
            klein

            Thanks for this quick reply, Sorbsbuster!

            I see.. i guess you mean that this trigger script is configured to run automatically at db startup. I think I could do it this way, but im still pretty curious about the approach using activeX, since i reckon, it will be faster and also handier, if there is more than one script to call.

            I am looking for a neat interface between a C++ application that controls a baffle gate and a higher-leveled FM-DB that does all the logging and contains all the client and membership data to determine the gate's state.

            Hence, the interface is 2-way, i.e. FM tells the C++ app to block/unblock the gate and the C++ app updates FM about any gate movements. Of course, delays should be minimized, so customers wouldnt get irritated when crossing the barrier.

            When I heard about FM's activeX capabilites, i assumed this would be the noblest way to implement the return path of the interface.

            • 3. Re: FM11 ActiveX Automation With C++
              Sorbsbuster

              This is all 'blue sky' thinking from someone who knows nothing about what you're talking about, but if you can get the C+ side of it to generate/populate a mySQL database, for example, then you can have Filemaker mount that db table as a table it can read and write to.  You can use that to exchange data, or make it mutally accessible.

              You could have a field in that table in that db with a FM script trigger attached to it: "If this field is 'RecordGateState', then run the script 'Update all Gate State data'.

              • 4. Re: FM11 ActiveX Automation With C++
                klein

                You could have a field in that table in that db with a FM script trigger attached to it: "If this field is 'RecordGateState', then run the script 'Update all Gate State data'.

                 

                What script trigger would that be? How would FM be notified about changes in the mySQL db made by the C++ application?

                • 5. Re: FM11 ActiveX Automation With C++
                  klein

                  By the way, I contacted Filemaker directly and asked them for an example of ActiveX automation with C++. They couldnt give me one either.

                  In the meanwhile, I found an acceptable workaround: the C++ app calls a VB script (FM script name as parameter). The VB script, in turn, calls the FM script . Nothing noble, but has run fast and stable so far. FM automation with ActiveX and VB script worked fine at the first go.