Do you ever want a complete snapshot of the current file state?
The following code creates a JSON formatted snapshot of every GET function for FileMaker v19.6.3, with the exception of Get(DocumentsPathListing)
.
You can paste the code into the Data Viewer or use it to generate a custom function.
JSONSetElement( ""
; ["AccountExtendedPrivileges" ; Get(AccountExtendedPrivileges) ; 1 ]
; ["AccountGroupName" ; Get(AccountGroupName) ; 1 ]
; ["AccountName" ; Get(AccountName) ; 1 ]
; ["AccountPrivilegeSetName" ; Get(AccountPrivilegeSetName) ; 1 ]
; ["AccountType" ; Get(AccountType) ; 1 ]
; ["ActiveFieldContents" ; Get(ActiveFieldContents) ; 1 ]
; ["ActiveFieldName" ; Get(ActiveFieldName) ; 1 ]
; ["ActiveFieldTableName" ; Get(ActiveFieldTableName) ; 1 ]
; ["ActiveLayoutObjectName" ; Get(ActiveLayoutObjectName) ; 1 ]
; ["ActiveModifierKeys" ; Get(ActiveModifierKeys) ; 2 ]
; ["ActivePortalRowNumber" ; Get(ActivePortalRowNumber) ; 2 ]
; ["ActiveRecordNumber" ; Get(ActiveRecordNumber) ; 2 ]
; ["ActiveRepetitionNumber" ; Get(ActiveRepetitionNumber) ; 2 ]
; ["ActiveSelectionSize" ; Get(ActiveSelectionSize) ; 2 ]
; ["ActiveSelectionStart" ; Get(ActiveSelectionStart) ; 2 ]
; ["AllowAbortState" ; Get(AllowAbortState) ; 2 ]
; ["AllowFormattingBarState" ; Get(AllowFormattingBarState) ; 2 ]
; ["ApplicationArchitecture" ; Get(ApplicationArchitecture) ; 1 ]
; ["ApplicationLanguage" ; Get(ApplicationLanguage) ; 1 ]
; ["ApplicationVersion" ; Get(ApplicationVersion) ; 1 ]
; ["CalculationRepetitionNumber" ; Get(CalculationRepetitionNumber) ; 2 ]
; ["ConnectionAttributes" ; Get(ConnectionAttributes) ; 1 ]
; ["ConnectionState" ; Get(ConnectionState) ; 2 ]
; ["CurrentDate" ; Get(CurrentDate) ; 1 ]
; ["CurrentExtendedPrivileges" ; Get(CurrentExtendedPrivileges) ; 1 ]
; ["CurrentHostTimestamp" ; Get(CurrentHostTimestamp) ; 1 ]
; ["CurrentPrivilegeSetName" ; Get(CurrentPrivilegeSetName) ; 1 ]
; ["CurrentTime" ; Get(CurrentTime) ; 1 ]
; ["CurrentTimestamp" ; Get(CurrentTimestamp) ; 1 ]
; ["CurrentTimeUTCMilliseconds" ; Get(CurrentTimeUTCMilliseconds) ; 2 ]
; ["CustomMenuSetName" ; Get(CustomMenuSetName) ; 1 ]
; ["DesktopPath" ; Get(DesktopPath) ; 1 ]
; ["Device" ; Get(Device) ; 2 ]
; ["DocumentsPath" ; Get(DocumentsPath) ; 1 ]
; ["DocumentsPathListing" ; "Get(DocumentsPathListing) is deliberately ignored" ; 1 ]
; ["EncryptionState" ; Get(EncryptionState) ; 2 ]
; ["ErrorCaptureState" ; Get(ErrorCaptureState) ; 2 ]
; ["FileLocaleElements" ; Get(FileLocaleElements) ; 3 ]
; ["FileMakerPath" ; Get(FileMakerPath) ; 1 ]
; ["FileName" ; Get(FileName) ; 1 ]
; ["FilePath" ; Get(FilePath) ; 1 ]
; ["FileSize" ; Get(FileSize) ; 2 ]
; ["FoundCount" ; Get(FoundCount) ; 1 ]
; ["HighContrastState" ; Get(HighContrastState) ; 2 ]
; ["HostApplicationVersion" ; Get(HostApplicationVersion) ; 1 ]
; ["HostIPAddress" ; Get(HostIPAddress) ; 1 ]
; ["HostName" ; Get(HostName) ; 1 ]
; ["InstalledFMPlugins" ; Get(InstalledFMPlugins) ; 1 ]
; ["InstalledFMPluginsAsJSON" ; Get(InstalledFMPluginsAsJSON) ; 3 ]
; ["LastError" ; Get(LastError) ; 2 ]
; ["LastErrorDetail" ; Get(LastErrorDetail) ; 1 ]
; ["LastErrorLocation" ; Get(LastErrorLocation) ; 1 ]
; ["LastMessageChoice" ; Get(LastMessageChoice) ; 2 ]
; ["LayoutAccess" ; Get(LayoutAccess) ; 2 ]
; ["LayoutCount" ; Get(LayoutCount) ; 2 ]
; ["LayoutName" ; Get(LayoutName) ; 1 ]
; ["LayoutNumber" ; Get(LayoutNumber) ; 2 ]
; ["LayoutTableName" ; Get(LayoutTableName) ; 1 ]
; ["LayoutViewState" ; Get(LayoutViewState) ; 2 ]
; ["MenubarState" ; Get(MenubarState) ; 2 ]
; ["ModifiedFields" ; Get(ModifiedFields) ; 2 ]
; ["MultiUserState" ; Get(MultiUserState) ; 2 ]
; ["NetworkProtocol" ; Get(NetworkProtocol) ; 1 ]
; ["NetworkType" ; Get(NetworkType) ; 1 ]
; ["OpenDataFileInfo" ; Get(OpenDataFileInfo) ; 1 ]
; ["PageCount" ; Get(PageCount) ; 2 ]
; ["PageNumber" ; Get(PageNumber) ; 2 ]
; ["PersistentID" ; Get(PersistentID) ; 1 ]
; ["PreferencesPath" ; Get(PreferencesPath) ; 1 ]
; ["PrinterName" ; Get(PrinterName) ; 1 ]
; ["QuickFindText" ; Get(QuickFindText) ; 1 ]
; ["RecordAccess" ; Get(RecordAccess) ; 2 ]
; ["RecordID" ; Get(RecordID) ; 2 ]
; ["RecordModificationCount" ; Get(RecordModificationCount) ; 2 ]
; ["RecordNumber" ; Get(RecordNumber) ; 2 ]
; ["RecordOpenCount" ; Get(RecordOpenCount) ; 2 ]
; ["RecordOpenState" ; Get(RecordOpenState) ; 2 ]
; ["RegionMonitorEvents" ; Get(RegionMonitorEvents) ; 1 ]
; ["RequestCount" ; Get(RequestCount) ; 2 ]
; ["RequestOmitState" ; Get(RequestOmitState) ; 2 ]
; ["ScreenDepth" ; Get(ScreenDepth) ; 2 ]
; ["ScreenHeight" ; Get(ScreenHeight) ; 2 ]
; ["ScreenScaleFactor" ; Get(ScreenScaleFactor) ; 2 ]
; ["ScreenWidth" ; Get(ScreenWidth) ; 2 ]
; ["ScriptAnimationState" ; Get(ScriptAnimationState) ; 2 ]
; ["ScriptName" ; Get(ScriptName) ; 1 ]
; ["ScriptParameter" ; Get(ScriptParameter) ; 1 ]
; ["ScriptResult" ; Get(ScriptResult) ; 1 ]
; ["SessionIdentifier" ; Get(SessionIdentifier) ; 1 ]
; ["SortState" ; Get(SortState) ; 2 ]
; ["StatusAreaState" ; Get(StatusAreaState) ; 2 ]
; ["SystemAppearance" ; Get(SystemAppearance) ; 1 ]
; ["SystemDrive" ; Get(SystemDrive) ; 1 ]
; ["SystemIPAddress" ; Get(SystemIPAddress) ; 1 ]
; ["SystemLanguage" ; Get(SystemLanguage) ; 1 ]
; ["SystemLocaleElements" ; Get(SystemLocaleElements) ; 3 ]
; ["SystemNICAddress" ; Get(SystemNICAddress) ; 1 ]
; ["SystemPlatform" ; Get(SystemPlatform) ; 2 ]
; ["SystemVersion" ; Get(SystemVersion) ; 1 ]
; ["TemporaryPath" ; Get(TemporaryPath) ; 1 ]
; ["TextRulerVisible" ; Get(TextRulerVisible) ; 2 ]
; ["TotalRecordCount" ; Get(TotalRecordCount) ; 2 ]
; ["TouchKeyboardState" ; Get(TouchKeyboardState) ; 2 ]
; ["TransactionOpenState" ; Get(TransactionOpenState) ; 2 ]
; ["TriggerCurrentPanel" ; Get(TriggerCurrentPanel) ; 1 ]
; ["TriggerExternalEvent" ; Get(TriggerExternalEvent) ; 1 ]
; ["TriggerGestureInfo" ; Get(TriggerGestureInfo) ; 1 ]
; ["TriggerKeystroke" ; Get(TriggerKeystroke) ; 1 ]
; ["TriggerModifierKeys" ; Get(TriggerModifierKeys) ; 1 ]
; ["TriggerTargetPanel" ; Get(TriggerTargetPanel) ; 1 ]
; ["UserCount" ; Get(UserCount) ; 1 ]
; ["UserName" ; Get(UserName) ; 1 ]
; ["UseSystemFormatsState" ; Get(UseSystemFormatsState) ; 2 ]
; ["UUID" ; Get(UUID) ; 1 ]
; ["UUIDNumber" ; Get(UUIDNumber) ; 1 ]
; ["WindowContentHeight" ; Get(WindowContentHeight) ; 2 ]
; ["WindowContentWidth" ; Get(WindowContentWidth) ; 2 ]
; ["WindowDesktopHeight" ; Get(WindowDesktopHeight) ; 2 ]
; ["WindowDesktopWidth" ; Get(WindowDesktopWidth) ; 2 ]
; ["WindowHeight" ; Get(WindowHeight) ; 2 ]
; ["WindowLeft" ; Get(WindowLeft) ; 2 ]
; ["WindowMode" ; Get(WindowMode) ; 2 ]
; ["WindowName" ; Get(WindowName) ; 1 ]
; ["WindowOrientation" ; Get(WindowOrientation) ; 2 ]
; ["WindowStyle" ; Get(WindowStyle) ; 2 ]
; ["WindowTop" ; Get(WindowTop) ; 2 ]
; ["WindowVisible" ; Get(WindowVisible) ; 2 ]
; ["WindowWidth" ; Get(WindowWidth) ; 2 ]
; ["WindowZoomLevel" ; Get(WindowZoomLevel) ; 1 ]
)
10 Likes
samfmp
April 19, 2023, 10:13am
2
Great function, I normally use the technique by Matt. Create a large text block and write down all get function. However, it will load a few seconds when I enter layout mode. Custom function may be a better approach.
1 Like
sounds interesting @samfmp - I don't recognize any Matt response here though?
samfmp
April 19, 2023, 2:53pm
4
Actually I have watched a video from Matt Petrowsky. I forgot which one, on his YouTube channel or magazine site.
1 Like
I liked this idea and went ahead and turned it into a custom function. I added the couple of new GET functions in FMP 2023 and also did some Substitutions to better format the output for when functions return a list.
/*********************************************
Name: getAllGetFunctions
Returns as JSON all of the GET functions as of FileMaker 20.1.1.35 with the following exclusions: Get (DocumentsPathListing)
Suggest using the output of this CF with JSONFormatElements for more readable output.
Notes:
- I am setting the JSON type for Get ( UUIDNumber ) to be 1 (JSONString). If I set it as 2 (JSONNumber), it returns the number result in scientific notation.
- Some functions return a list. JSONSetElement changes carriage return chars to be "\r". I convert these to ", " for readability.
- Some plugins have new line characters in their description. JSONSetElement changes these to be "\n\n". I convert these to " " for readability.
I was testing when a function returned a list to have this be turned into a child element with an array as shown in the snippet and output below. This worked if you want to use it. You would need to apply this to the other functions that return a list of values. If you do this, just double check that the main Substitutions are still needed and/or need modifying.
[ "SystemIPAddress";
Let(
[
~string = JSONSetElement( ""; "IPAddress"; Get( SystemIPAddress ); 1 );
~firstColonPosition = Position( ~string; ":"; 1; 1 );
~string2 = Replace( ~string; ~firstColonPosition; 1; ":[" );
~jsonArray = Substitute( ~string2; [ "\r"; "\",\"" ]; [ "}"; "]}" ] )
];
~jsonArray
); 3 ];
[ "SystemNICAddress";
Let(
[
~string = JSONSetElement( ""; "NICAddress"; Get( SystemNICAddress ); 1 );
~firstColonPosition = Position( ~string; ":"; 1; 1 );
~string2 = Replace( ~string; ~ firstColonPosition; 1; ":[" );
~jsonArray = Substitute( ~string2; [ "\r"; "\",\"" ]; [ "}"; "]}" ] )
];
~jsonArray
); 3 ]
Example of how SystemIPAddress shows when we format values as a child element with an array.
"SystemIPAddress": {
"IPAddress": [
"192.168.58.118",
"192.168.58.6",
"10.211.55.2",
"10.37.129.2",
"10.20.30.7"
]
}
*********************************************/
Substitute(
JSONSetElement(
"";
[ "AccountExtendedPrivileges"; Get( AccountExtendedPrivileges ); 1 ];
[ "AccountGroupName"; Get( AccountGroupName ); 1 ];
[ "AccountName"; Get( AccountName ); 1 ];
[ "AccountPrivilegeSetName"; Get( AccountPrivilegeSetName ); 1 ];
[ "AccountType"; Get( AccountType ); 1 ];
[ "ActiveFieldContents"; Get( ActiveFieldContents ); 1 ];
[ "ActiveFieldName"; Get( ActiveFieldName ); 1 ];
[ "ActiveFieldTableName"; Get( ActiveFieldTableName ); 1 ];
[ "ActiveLayoutObjectName"; Get( ActiveLayoutObjectName ); 1 ];
[ "ActiveModifierKeys"; Get( ActiveModifierKeys ); 2 ];
[ "ActivePortalRowNumber"; Get( ActivePortalRowNumber ); 2 ];
[ "ActiveRecordNumber"; Get( ActiveRecordNumber ); 2 ];
[ "ActiveRepetitionNumber"; Get( ActiveRepetitionNumber ); 2 ];
[ "ActiveSelectionSize"; Get( ActiveSelectionSize ); 2 ];
[ "ActiveSelectionStart"; Get( ActiveSelectionStart ); 2 ];
[ "AllowAbortState"; Get( AllowAbortState ); 2 ];
[ "AllowFormattingBarState"; Get( AllowFormattingBarState ); 2 ];
[ "ApplicationArchitecture"; Get( ApplicationArchitecture ); 1 ];
[ "ApplicationLanguage"; Get( ApplicationLanguage ); 1 ];
[ "ApplicationVersion"; Get( ApplicationVersion ); 1 ];
[ "CacheFileName"; Get( CacheFileName ); 1 ];
[ "CacheFilePath"; Get( CacheFilePath ); 1 ];
[ "CalculationRepetitionNumber"; Get( CalculationRepetitionNumber ); 2 ];
[ "ConnectionAttributes"; Get( ConnectionAttributes ); 1 ];
[ "ConnectionState"; Get( ConnectionState ); 2 ];
[ "CurrentDate"; Get( CurrentDate ); 1 ];
[ "CurrentExtendedPrivileges"; Get( CurrentExtendedPrivileges ); 1 ];
[ "CurrentHostTimestamp"; Get( CurrentHostTimestamp ); 1 ];
[ "CurrentPrivilegeSetName"; Get( CurrentPrivilegeSetName ); 1 ];
[ "CurrentTime"; Get( CurrentTime ); 1 ];
[ "CurrentTimestamp"; Get( CurrentTimestamp ); 1 ];
[ "CurrentTimeUTCMicroseconds"; Get( CurrentTimeUTCMicroseconds ); 2 ];
[ "CurrentTimeUTCMilliseconds"; Get( CurrentTimeUTCMilliseconds ); 2 ];
[ "CustomMenuSetName"; Get( CustomMenuSetName ); 1 ];
[ "DesktopPath"; Get( DesktopPath ); 1 ];
[ "Device"; Get( Device ); 2 ];
[ "DocumentsPath"; Get( DocumentsPath ); 1 ];
[ "DocumentsPathListing"; "Get(DocumentsPathListing) is deliberately ignored"; 1 ];
[ "EncryptionState"; Get( EncryptionState ); 2 ];
[ "ErrorCaptureState"; Get( ErrorCaptureState ); 2 ];
[ "FileLocaleElements"; Get( FileLocaleElements ); 3 ];
[ "FileMakerPath"; Get( FileMakerPath ); 1 ];
[ "FileName"; Get( FileName ); 1 ];
[ "FilePath"; Get( FilePath ); 1 ];
[ "FileSize"; Get( FileSize ); 2 ];
[ "FoundCount"; Get( FoundCount ); 1 ];
[ "HighContrastState"; Get( HighContrastState ); 2 ];
[ "HostApplicationVersion"; Get( HostApplicationVersion ); 1 ];
[ "HostIPAddress"; Get( HostIPAddress ); 1 ];
[ "HostName"; Get( HostName ); 1 ];
[ "InstalledFMPlugins"; Get( InstalledFMPlugins ); 1 ];
[ "InstalledFMPluginsAsJSON"; Get( InstalledFMPluginsAsJSON ); 3 ];
[ "LastError"; Get( LastError ); 2 ];
[ "LastErrorDetail"; Get( LastErrorDetail ); 1 ];
[ "LastErrorLocation"; Get( LastErrorLocation ); 1 ];
[ "LastMessageChoice"; Get( LastMessageChoice ); 2 ];
[ "LayoutAccess"; Get( LayoutAccess ); 2 ];
[ "LayoutCount"; Get( LayoutCount ); 2 ];
[ "LayoutName"; Get( LayoutName ); 1 ];
[ "LayoutNumber"; Get( LayoutNumber ); 2 ];
[ "LayoutTableName"; Get( LayoutTableName ); 1 ];
[ "LayoutViewState"; Get( LayoutViewState ); 2 ];
[ "MenubarState"; Get( MenubarState ); 2 ];
[ "ModifiedFields"; Get( ModifiedFields ); 2 ];
[ "MultiUserState"; Get( MultiUserState ); 2 ];
[ "NetworkProtocol"; Get( NetworkProtocol ); 1 ];
[ "NetworkType"; Get( NetworkType ); 1 ];
[ "OpenDataFileInfo"; Get( OpenDataFileInfo ); 1 ];
[ "PageCount"; Get( PageCount ); 2 ];
[ "PageNumber"; Get( PageNumber ); 2 ];
[ "PersistentID"; Get( PersistentID ); 1 ];
[ "PreferencesPath"; Get( PreferencesPath ); 1 ];
[ "PrinterName"; Get( PrinterName ); 1 ];
[ "QuickFindText"; Get( QuickFindText ); 1 ];
[ "RecordAccess"; Get( RecordAccess ); 2 ];
[ "RecordID"; Get( RecordID ); 2 ];
[ "RecordModificationCount"; Get( RecordModificationCount ); 2 ];
[ "RecordNumber"; Get( RecordNumber ); 2 ];
[ "RecordOpenCount"; Get( RecordOpenCount ); 2 ];
[ "RecordOpenState"; Get( RecordOpenState ); 2 ];
[ "RegionMonitorEvents"; Get( RegionMonitorEvents ); 1 ];
[ "RequestCount"; Get( RequestCount ); 2 ];
[ "RequestOmitState"; Get( RequestOmitState ); 2 ];
[ "ScreenDepth"; Get( ScreenDepth ); 2 ];
[ "ScreenHeight"; Get( ScreenHeight ); 2 ];
[ "ScreenScaleFactor"; Get( ScreenScaleFactor ); 2 ];
[ "ScreenWidth"; Get( ScreenWidth ); 2 ];
[ "ScriptAnimationState"; Get( ScriptAnimationState ); 2 ];
[ "ScriptName"; Get( ScriptName ); 1 ];
[ "ScriptParameter"; Get( ScriptParameter ); 1 ];
[ "ScriptResult"; Get( ScriptResult ); 1 ];
[ "SessionIdentifier"; Get( SessionIdentifier ); 1 ];
[ "SortState"; Get( SortState ); 2 ];
[ "StatusAreaState"; Get( StatusAreaState ); 2 ];
[ "SystemAppearance"; Get( SystemAppearance ); 1 ];
[ "SystemDrive"; Get( SystemDrive ); 1 ];
[ "SystemIPAddress"; Get( SystemIPAddress ); 1 ];
[ "SystemLanguage"; Get( SystemLanguage ); 1 ];
[ "SystemLocaleElements"; Get( SystemLocaleElements ); 3 ];
[ "SystemNICAddress"; Get( SystemNICAddress ); 1 ];
[ "SystemPlatform"; Get( SystemPlatform ); 2 ];
[ "SystemVersion"; Get( SystemVersion ); 1 ];
[ "TemporaryPath"; Get( TemporaryPath ); 1 ];
[ "TextRulerVisible"; Get( TextRulerVisible ); 2 ];
[ "TotalRecordCount"; Get( TotalRecordCount ); 2 ];
[ "TouchKeyboardState"; Get( TouchKeyboardState ); 2 ];
[ "TransactionOpenState"; Get( TransactionOpenState ); 2 ];
[ "TriggerCurrentPanel"; Get( TriggerCurrentPanel ); 1 ];
[ "TriggerExternalEvent"; Get( TriggerExternalEvent ); 1 ];
[ "TriggerGestureInfo"; Get( TriggerGestureInfo ); 1 ];
[ "TriggerKeystroke"; Get( TriggerKeystroke ); 1 ];
[ "TriggerModifierKeys"; Get( TriggerModifierKeys ); 1 ];
[ "TriggerTargetPanel"; Get( TriggerTargetPanel ); 1 ];
[ "UserCount"; Get( UserCount ); 1 ];
[ "UserName"; Get( UserName ); 1 ];
[ "UseSystemFormatsState"; Get( UseSystemFormatsState ); 2 ];
[ "UUID"; Get( UUID ); 1 ];
[ "UUIDNumber"; Get( UUIDNumber ); 1 ];
[ "WindowContentHeight"; Get( WindowContentHeight ); 2 ];
[ "WindowContentWidth"; Get( WindowContentWidth ); 2 ];
[ "WindowDesktopHeight"; Get( WindowDesktopHeight ); 2 ];
[ "WindowDesktopWidth"; Get( WindowDesktopWidth ); 2 ];
[ "WindowHeight"; Get( WindowHeight ); 2 ];
[ "WindowLeft"; Get( WindowLeft ); 2 ];
[ "WindowMode"; Get( WindowMode ); 2 ];
[ "WindowName"; Get( WindowName ); 1 ];
[ "WindowOrientation"; Get( WindowOrientation ); 2 ];
[ "WindowStyle"; Get( WindowStyle ); 2 ];
[ "WindowTop"; Get( WindowTop ); 2 ];
[ "WindowVisible"; Get( WindowVisible ); 2 ];
[ "WindowWidth"; Get( WindowWidth ); 2 ];
[ "WindowZoomLevel"; Get( WindowZoomLevel ); 1 ]
);
[ "\r"; ", " ];
[ "\n\n"; " " ]
)
5 Likes
Good topic, post, and replies..
Timely, as we are using a pre-pre-FM 16 version that is on the To Do list for a modernization.
We use this type of Calculation/Custom Function as part of our HelpRequest system. Currently we "Get" info from 3 scopes: Script, File&Layout, and Environment/Install passing them along the ScriptStack and writing them out to fields in a HelpRequest record.
We also add some items:
Script Comment
@scriptID
@layoutID
DatabaseNames
WindowNames
etc.
Might (or might not) be good to break this code up by "scope".
Would that make the code much more efficient?
Easier to upgrade as new Get ( Functions ) ship, for example, Get ( ScriptStack ) and Get ( DockDetails ) ;-0 ?
This Scope InfoG probably has a few errors (and is obviously not up to date)