April 29, 201213 yr I would like to restrict certain functionality depending on whether the host or a client is trying to access it. I thought I would compare the 'host name' to 'client name' or 'host IP' to 'client IP'. I know where I can get the host name and host IP address for the database, but don't see a way to 'Get' either of the client data. If they aren't available, how do I test in a script whether it is the host or a client that is accessing the script?
April 29, 201213 yr Please check if Get(UserCount) will fit your aim. Because if it's >1 the user is a client.
April 29, 201213 yr The statement "whether the host or a client is trying to access it" does not make sense to me. The host never accesses a file. If you are referring to a file hosted using FM Server, and asking how to know whether a script is being run by FM Server (as a server-side script) then use the Get( ApplicationVersion ) function.
April 29, 201213 yr Author The application is not on a server. My users' installations typically may have one or 2 other computers wanting to share the file. The 'host' is the main activity hub of their installation and does most of the accessing of the file, but others may access the application via iPad, or other networked computer. 'Get(HostName)' gives me the name of the 'hub' computer - the computer that hosts the file - from whichever computer i check (as I would expect). I want to know when the iPad/Computer trying to access a script is NOT the host computer. If I could 'Get' the name of the computer requesting the script be run I could compare the names. Get(usercount) doesn't do it since it gives the same result from any active networked device - host or client. Still looking for a solution!! Is there a way to 'Get' the Name of the current computer? Please help.
April 29, 201213 yr I want to know when the iPad/Computer trying to access a script is NOT the host computer. If I could 'Get' the name of the computer requesting the script be run I could compare the names. Ok, you're using FMP to host the file, not FMS. Which means there is ALWAYS one user -- the host computer's copy of FMP. All other users should be >1. Get(usercount) doesn't do it since it gives the same result from any active networked device - host or client. Still looking for a solution!! Is there a way to 'Get' the Name of the current computer? Please help. Get( UserCount ) SHOULD do the trick. Make sure the calculation is unstored. If the calculation is stored then it will never update. However, the Get( MultiUserState ) function is specifically designed for this purpose. It should return 1 when evaluated from the host computer and 2 if evaluated from a client. Remember to make this calculation unstored as well.
April 30, 201213 yr Author 'Get(multiuserstate)' seems to do the trick. With the host and one client running, the result is '1' on the host and '2' on the client. Thanks!
Create an account or sign in to comment