4 Replies Latest reply on Jan 14, 2015 11:10 AM by ScottBleackley

    How can a script tell if it is being operated as PSoS?

    ScottBleackley

      Title

      How can a script tell if it is being operated as PSoS?

      Your post

      Is there an easy way for a script running on a server to know is it is being operated in the context of PSoS?

      Sometimes the server will be used remotely from a client, but sometimes it will be used by things like FMEasySync using PSoS.  If I am moving to a layout based on data in an "On Load Record" trigger it would be reasonable to skip this step if I am operating in the context of PSoS as opposed to just remotely from a client.


       

       

       

       

        • 1. Re: How can a script tell if it is being operated as PSoS?
          RickWhitelaw

          I really don't understand the entire question, but 

          " If I am moving to a layout based on data in an "On Load Record" trigger "

          in particular.

           

          • 2. Re: How can a script tell if it is being operated as PSoS?
            Markus Schneider

            as a rule of thumb: Create separate scripts - and in Your situation, separate layouts without triggers - for PSoS.

            Besides of this: Try using the 'get functions', ie get (ApplicationVersion) or similar, I don't have an english version here

             

            ** Sorry for typing mistakes - but it's impossible to edit postings on iPad here

            • 3. Re: How can a script tell if it is being operated as PSoS?
              bigtom

              Application version, machine name, user name, IP address. Maybe a combo of those. I put in a get application version for my startup script that bypasses a bunch of stuff that is only needed for the actual clients like navigating to a certain layout or a startup sort. This works to speed up running scheduled scripts on the server a lot. I believe PSOS runs scripts as a scheduled script so that should work for you. Remember that every instance of a Server Side script will run your startup script if you have one. This includes PSOS. 

              To be specific I use this:

              If [LeftWords ( Get (ApplicationVersion) ; 1 ) = "Server"]

                 Exit Script[]

              End If

              Hope that will help you out. You can use it as a standard IF or and IF ELSE or whatever fits your script for what you need. If there are a number of places in one script you may want to evaluate only once and set a variable to use throughout the script.

              • 4. Re: How can a script tell if it is being operated as PSoS?
                ScottBleackley

                While this is quite helpful to tell me if I am on a server or not, it does not tell me if I have a process that has been initiated by Perform Script on Server, which is different that say logging in and using the server as some aspects of the server environment such as otherwise predefined global variables are not accessible from PerformScriptOnServer.