3 Replies Latest reply on Sep 6, 2012 1:05 PM by Stephen Huston

    OnLastWindowClose help!

    erickaczmarczyk

      In our database, it is set up to automatically return to the homepage after closing the last window.

      However, if on the host machine, it asks you to notify connected users instead of performing the script trigger.

      Any thoughts? how to ignore this message in the script trigger?

      thanks!

        • 1. Re: OnLastWindowClose help!
          DavidJondreau

          Are you sure you want to close the host if people are connected? What is this "home page" and does the host need to return to it?

           

          Maybe a simple check at the beginning of the script?

           

          Set Error Capture [ On ]

          If [ IsEmpty ( Get ( HostIPAddress ) ) ]

          Close File

          Exit Script[]

          End If

          • 2. Re: OnLastWindowClose help!
            Mike_Mitchell

            I tend to agree with David. I'm assuming (from the way your question is phrased) that you're hosting the database in a peer-to-peer configuration. In such a situation, it's inherently dangerous to force a guest to close. You might at the very least lose that user's changes; in a more serious situation, you can corrupt your database.

             

            Maybe if you gave us a little more detail, it might help. It sounds like you have users who are manually forcing other users out, and then your exit script isn't returning to the correct layout because of it. I think you might be better served if, instead of trying to figure out how to bypass the warning about connected users, you turn your attention to keeping your users from doing things that might damage their data. That might be done through a combination of user education (as in, "Don't do that!") and a script like David suggests, coupled with a warning dialog that says, "Hey! You're about to do something that might damage your data! Stop! Cease! Desist!"   

             

            Just my $0.02.

             

            Mike

            • 3. Re: OnLastWindowClose help!
              Stephen Huston

              I agree as well, when hosting peer-to-peer, you never want to allow the host machine to close the last window of a file if anyone else is connected.

               

              You can use the calculation engine to tell you how many clients are connected at the time, and use that information to branch your scripts used to control exiting a file or the FM application.

               

              In fact, the only peer-to-peer hosting I ever set up used a dedicated host machine to run FMPro, keeping it always open, and we disconnected the keyborad an mouse so there would never be a person messing with our cheapo-not-quite-server. Peer-to-peer involves a lot of risk if you let someone actually work at the host machine.

               

              If you can spring for FM Server on a dedicated, it's well worth the change. If you can't, at least make the peer-to-peer host machine into a pseudo-server which is dedicated to FMPro hosting.