5 Replies Latest reply on Apr 5, 2012 1:33 PM by MarcMcCall

    Script step bypass if file is open and being hosted

    MarcMcCall

      Title

      Script step bypass if file is open and being hosted

      Post

      Hey guys,

       

      I have an open script, that sets the Nic Address in a field and another field that has an encrypted code that locks the solution to the computer it installed on.  The file will always be hosted by the same computer and accessed by the other pc's through the open remote.  What I would like to accomlish is have the script perform the way it does when it is first opened by the first user, then If someone goes through the open remote to login to the open file it bypasses the perform script step I have in place to keep it locked to the computer.  The problem is, if it performs that script, it sets the resets the Nic address of the computer trying to access it through the open remote, and the encrypted code does not match the the Nic address it is encrypted to and the file wil not open corectly.  So I guess it would have to check somehow to see if there are any current users first befor my perform script, or something along those lines, but not quite sure how to write it.

        • 1. Re: Script step bypass if file is open and being hosted
          philmodjunk

          There are some get functions you can play with.

          Get ( MultiUserState ) returns a 1 if you are accessing from the host and 2 if you are using remote access to access as a client.

          There are a number of other options here you may want to investigate such as one for getting the host computer's name and another that returns the Host IP address...

          • 2. Re: Script step bypass if file is open and being hosted
            MarcMcCall

            That's what I think I was looking for.  I can perform an "If" just before my script and If it returns a 2 it can bypass my Nic address script.  Thanks for the input..

            • 3. Re: Script step bypass if file is open and being hosted
              philmodjunk

              The script, however, won't run "on file open" when server opens the file to host it over the network, so if this is a solution to be hosted by server, you'll need to rethink the process...

              • 4. Re: Script step bypass if file is open and being hosted
                MarcMcCall

                It is only going to be hosted via a pc running filemaker pro 11 advanced.  If it makes a difference, it will be a standard .fp7 file not a runtime. This is my start up script:

                 

                Allow user abort [Off]

                Perform Script ["check filemaker version"]

                Go To layout ["Splash" (System)]

                Show/Hide Status Area [Lock;Hide]

                Adjust Window [Resize to fit]

                Pause/Resume Script[Duration(seconds):3]

                Perform Script ["SetNicAddress"]

                Perform Script ["Code:Validate[RegName,RegCode]";Parameter: System::NicAddr & "|" & System::TestRegCode]

                If [Get(ScriptResult)= True]

                Perform Script ["Startup"]

                Else

                Go to Layaout ["Registration"]

                Show/Hide Status Area[Lock/Hide]

                Adjust Window[Resize to Fit]

                Beep

                Show Custom Dialog[" Blah Blah Blah"]

                End If

                 

                If what you sugested will work with my cofiguration, I would change the script to:

                 

                Allow user abort [Off]

                Perform Script ["check filemaker version"]

                Go To layout ["Splash" (System)]

                Show/Hide Status Area [Lock;Hide]

                Adjust Window [Resize to fit]

                Pause/Resume Script[Duration(seconds):3]

                If Get ( MultiUserState )=2

                Perform Script ["Startup"]

                Else

                Perform Script ["SetNicAddress"]

                Perform Script ["Code:Validate[RegName,RegCode]";Parameter: System::NicAddr & "|" & System::TestRegCode]

                If [Get(ScriptResult)= True]

                Perform Script ["Startup"]

                Else

                Go to Layaout ["Registration"]

                Show/Hide Status Area[Lock/Hide]

                Adjust Window[Resize to Fit]

                Beep

                Show Custom Dialog[" Blah Blah Blah"]

                End If

                 

                Once the Registration is filled in there is a button that performs the same script.

                • 5. Re: Script step bypass if file is open and being hosted
                  MarcMcCall

                  Just wanted to add this also.  So far the whole thing works good. I havent made the changes till I get home, the problem came in when trying to open the file remotely.  It was resetting the Nic Address to the computer opening it remotely and the Nic Address Validation was giving a False reply and sending the script to the Registration layout.