Xojo Conferences
MBSOct2019CologneDE
XDCMarch2020NashvilleUS

« Office view this week… | Home | MBS FileMaker Plugin,… »

Tip of the day: Query connected clients on FileMaker Server by script


Today at a visit of Team Nifty, we talked about FileMaker development, deployment, iOS, Server and a lot of more things. While discussing import and export of data and coded a few new plugin functions. So I added two new useful functions to parse and format dates, times and timestamp in any way. Time.Format takes a timestamp and formats it in the way you specify. The other way around Time.Parse takes a text and parses a date. You can specify formats exactly and read/write dates, times and timestamps in the format you need.
 
Patrick Weh show me a nice way to figure out what clients are connected to a FileMaker Server. He runs a script which uses a shell command with our RunTask functons to ask the server via the fmsadmin tool for the list of connected users:
 

# © 30.07.2016 Patrick Weh | Team Nifty GmbH (17:40 Uhr)

# List connected Clients

# ------------------------------------------------------------------------------------------------------------

# Script checks for connected clients at the FileMaker Server.

# Copy this File to your Server and run this Script on your FileMaker Server.

# ------------------------------------------------------------------------------------------------------------

#

Set Error Capture [On]

Allow User Abort [Off]

#

Set Variable [$r; Value:MBS( "RunTask.NewTask" )]

Set Variable [$r; Value:MBS( "RunTask.SetLaunchPath"; "/Library/FileMaker Server/Database Server/bin/fmsadmin" )]

# please put your admin password here

Set Variable [$r; Value:MBS( "RunTask.SetArguments"; "-u" ; "fmserveradmin" ; "-p" ; "fmserveradminpassword" ; "list" ; "clients" ; "-s" )]

Set Variable [$r; Value:MBS( "RunTask.Launch")]

# now wait for task to finish:

Set Variable [$result; Value:""]

Loop

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

Set Variable [$result; Value:$result & MBS("RunTask.ReadOutputText")]

Exit Loop If [MBS("RunTask.IsRunning")  ≠ 1]

End Loop

#

# write into a field:

Set Field [Check clients::Clients; $result]

Commit Records/Requests [No dialog]

#

 
Of course this script must run on the FileMaker server, either as scheduled script, perform script on server or as part of a FM Pro on the server machine.
 
17 08 16 - 21:10