Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Notification.Listen

Starts listening for a notification.

Component Version macOS Windows Linux Server iOS SDK
Notification 2.6 ✅ Yes ✅ Yes ❌ No ❌ No ❌ No
MBS( "Notification.Listen"; NotificationName; FileName; ScriptName )   More

Parameters

Parameter Description Example
NotificationName The name of the notification. "de.mbsplugins.MyTestNotification"
FileName The name of the FileMaker File that contains the script
ScriptName The name of the script to run

Result

Returns "OK" or error message.

Description

Starts listening for a notification.
Specify a filename and script name to have this script being called when a notification is received. The script parameter will be the notification name plus parameters.
Although the notification name can be any text, you probably want to use reverse dns notation to avoid conflicts.

This is implemented with Distributed Notifications on Mac and named messaged on Windows. You can use our NSDistributedNotificationCenterMBS and WinNotificationMBS classes in the Real Studio plugins to send/receive this notifications.

Version 7.2 and newer pass parameters to the script call. On Windows you get both parameters (WParam and LParam).

For version 7.3 you can receive a payload in json as script parameter to the script call after the name of notification.

If you need to trigger scripts on other computers, please check UDPSocket or ServerSocket functions.


With plugin version 6.0 or newer the script name can be a script ID number. In that case the plugin queries the script name for the given script ID. This allows to call scripts by ID and avoid problems if scripts are later renamed.

Notice: FileMaker 19.2 adds a fmplugin extended privileges. If you have such an extended privileges to allow the plugin to trigger scripts, you need to grant permissions for it. If such a privilege is not defined, the plugin is allowed to trigger scripts. See FileMaker product documentation for details.

Examples

Registers script event:

MBS( "Notification.Listen"; "de.mbsplugins.MyTestNotification"; Get ( FileName ); "GotTestNotification")

Listen for device change event on Windows:

MBS( "Notification.Listen"; 537; Get ( FileName ); "DeviceChanged")

// Notifies an application of a change to the hardware configuration of a device or the computer.

Listen for System time change event on Windows:

MBS( "Notification.Listen"; 31; Get ( FileName ); "TimeChangedTrigger")

Listen for display change on Windows:

MBS( "Notification.Listen"; 126; Get ( FileName ); "DisplayChangedTrigger")

// The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 19th March 2020


Notification.List - Notification.Send