8 Replies Latest reply on Jun 17, 2013 5:23 AM by padster18

    ActiveX and Getting Active Doc

    padster18

      Hi,

       

      I've run into a bit of a problem in regards to using automation. I was wondering if anybody else had come across this problem, and if so, how to overcome this problem. As a basic over-view, we are using automation to integrate with Citrix. This is to allow for users to have a seemless experience while using FileMaker through a Citrix session.

       

      The problem that we have come across, as part of our 'error catching', we have put in a function that tests whether FileMaker has an open DB. What happens is that if FileMaker is in a specific state, FM will respond and say that there is no Active DB open. The Call that we are using to test this is "(FMPRO70Lib.IFMIDocument)fileMakerDocs.Active". When a DB is open, this will reposnd with the DB name/s, else it will fail and respond 'Null'

       

      For a bit more detail on the state; When you open a Database, a normal DB window will open, all is well. If you then open a 'Floating Window' and set that as the point of focus, FileMaker will respond to the above command and say that there is no open DB. switch the Focus to the Normal window again, and the command will respond with the DB name/s.

       

      So what this means is that in some instances, if you try to complete a ActiveX call to run a script and you are, or end up on a Floating Window, then this ActiveX call will Fail, as the Error Catching will stop the command from being sent. FileMaker will fail anyway, as the Command get lost due to it thinking that there is no open DB.

       

      I have raised this as a support call with FM but they have directed me to the forums.

       

      Any help or advice is greatly appreciated.

       

      Pad

        • 1. Re: ActiveX and Getting Active Doc
          wimdecorte

          So far I have not been able to reproduce this.

           

          Using FM with an FM native modal window open.  Using a Powershell script to get the active document: it has all the right properties including the full name.

           

          What environment / language are you using?

          • 2. Re: ActiveX and Getting Active Doc
            padster18

            Hey Wimdecorte,

             

            Currently using CSharp to query FileMaker.

             

            The problem does not actually occur under a Modal (Dialog) window, only under a Floating Window. To recreate this error, open a new Blank DB (only DB open). Simple script;

             

            Set variable [ $old ; Get ( WindowName) ]

            New Window [ Name: "Floating" - Type:Floating]

            Close Window [$old]

             

            To test, I would run the query on FM before you run the script, and then after.

             

            Running the revers of this script to open a normal window instead of a Floating window should rest the FilerMakerDoc to return an active result.

             

            Though this is not what you would normally run as a task, the error will occur when you just open a Floating Window in some situations, thus causing potential problems at random within the normal working of a DB.

             

            I have raised this as an application error with FM Support, and they have been able to verify my finds. They have made no mention about solutions, fixes, or workarounds. Though I might expect something to be amended in the next version or release that would fix the problem.

             

            Pad

            • 3. Re: ActiveX and Getting Active Doc
              wimdecorte

              Got it.  I see the error when it's a floating window.  The bug does not happen on a regular document window or a modal window.  Good catch!

              • 4. Re: ActiveX and Getting Active Doc
                padster18

                It is fairly annoy, as the floating window makes for a better UI on Windows OS. But, we shall see what happens.

                 

                I have a level of work around built into my CSharp script which tests the active doc before doing anything, and informs the user that the error has occurred. At the moment, the only solution is to close all DB and reopen.. Which is less that optimal of User Experience

                • 5. Re: ActiveX and Getting Active Doc
                  wimdecorte

                  The issue only happens if the ONLY window of the file is a floating window... if you don't close the old window in your example then the code still works.

                  I hear you on the annoying part.

                  • 6. Re: ActiveX and Getting Active Doc
                    padster18

                    I have found that at times, if the Floating Window is open for so long, the ActiveDoc does not, unlock (not sure on what the best term is) when the floating window is closed, which means that when you return to the normal DB window only, the ActiveDoc stays as Null.

                     

                    This is not all the time though, and I've not been able to pin this one to either an exact amount of time or if it another script that is run while the floating window is open. I will keep you posted if I find the reason.

                    • 7. Re: ActiveX and Getting Active Doc
                      wimdecorte

                      There is a known bug where FM's activeX interface will stop responding if you make a certain amount of calls to it in a given time frame.  Never been able to determine the # of calls or the time frame but the issue is definitely there.  That may be what you are seeing when you make calls with a regular and a floating window open...

                      • 8. Re: ActiveX and Getting Active Doc
                        padster18

                        Interesting. I will have to look into that a bit more then to see if I can determine this.

                         

                        I have found though, that sometime even when I don't make any calls it stops responding, so the time might be the key driver here, over the # of calls.