Get(InstalledFMPluginsAsJSON)
Returns a JSON object with the attributes of installed plug-ins.
Format
Get ( InstalledFMPluginsAsJSON )
Parameters
None
Data type returned
text
Originated in version
19.2.2
Description
This function returns the same information as the Get(InstalledFMPlugins) function, except that it's a JSON object and includes additional information.
In the following example of the returned JSON object, there are two installed plug-ins in the plugins
array.
{
"APIVers": 2,
"environment" :
{
"architecture" : "arm64",
"platform" : 1,
"version" : "11.3"
},
"plugins":
[
{
"name": "MyPlugin1",
"id": "XM32",
"version": "1.0",
"state": "Enabled",
"filepath": "filemac:/HD/Users/user1/Library/Application Support/FileMaker/Extensions/MyPlugin1.fmplugin/",
"description": "This is a sample FileMaker plug-in."
},
{
"name": "MyPlugin2",
"id": "BO3B",
"version": "1.1.6x3422",
"state": "Disabled",
"filepath": "filemac:/HD/Users/user1/Library/Application Support/FileMaker/FileMaker Pro/21.1/Extensions/MyPlugin2.fmplugin/",
"description": "This is another FileMaker plug-in."
}
]
}
The following table describes the elements in the returned JSON object.
JSON element |
Description |
---|---|
APIVers
|
Numeric value for the version of this JSON object's structure. If the structure of this JSON object changes in a subsequent release, this number will change. Version 2: Added |
environment
|
Object that describes the system that plug-ins run on. Returned even if no plug-ins are currently installed. Includes these keys:
|
plugins
|
Array containing an object for each installed plug-in. If no plug-ins are installed, the value is null. |
name
|
Plug-in's name |
id
|
Plug-in's four-character ID (see About controlling plug-in access between files) |
version
|
Plug-in's version number as a string |
state
|
Whether the plug-in is currently enabled in Settings and is loaded:
|
filepath
|
Path of the plug-in file in FileMaker format (see Creating file paths) |
description
|
Plug-in's description |
The name, version, and description are the values provided by the plug-in developer in the plug-in's resource file (Windows) or the info.plist file (macOS).
Example 1
Returns the number of installed plug-ins.
ValueCount ( JSONListKeys ( Get ( InstalledFMPluginsAsJSON ) ; "plugins" ) )
Example 2
Returns the version number of the plug-in with the ID specified by the $$id
variable. For the system that returns the example JSON object above, the following calculation returns 1.0 if $$id
is "XM32".
While (
[
plugin_json = Get ( InstalledFMPluginsAsJSON ) ;
total = ValueCount ( JSONListKeys ( plugin_json ; "plugins" ) ) ;
index = 0 ;
version = ""
] ;
index < total ;
[
version = If ( JSONGetElement ( plugin_json ; "plugins[" & index & "].id" ) = $$id ;
JSONGetElement ( plugin_json ; "plugins[" & index & "].version" ) ; "" ) ;
index = If ( version = "" ; index + 1 ; total )
] ;
version
)
Example 3
See Example 2 in Install Plug-In File.