Idle Call
From FM Plugin Wikipedia
You can have FileMaker call your plugin during the standard system idle call. During this time, you can execute call backs to FileMaker, including Script and/or SQL callbacks.
NOTE : Be careful that your idle code doesn't take too much time - it's called frequently and any time it takes reduces the overall performance of FileMaker.
Step One - Enable Idle Time Flag
Set the 'Want idle time' flag in the plugin Option String to be 'Y' (the third to last flag)
#define IDMA_Plugin_OptionString "IDMA1nnYYnn" // ^--^ || | |---- // No Win32s support // | || |------ // Want idle time // | ||-------- // No old external functions // | |--------- // Has preferences dialog // |-------------- // 'IDMA' plug-in ID
Step Two - Do_PluginIdle function
In your main file, you will find the 'Do_PluginIdle' function.
static void Do_PluginIdle(FMX_IdleLevel idleLevel) { if (pluginIsRunningOnFMPro) // Only execute if running on client or runtime (ie. don't call when on server) { // BOOL pluginIsRunningOnFMPro set during plugin init // Check idle state switch (idleLevel) { case kFMXT_UserIdle: { // The user hasn't done anything for 30 seconds or more. (mouse movement don't reset this) } break; case kFMXT_UserNotIdle: { // The user has done something within the last 30 seconds } break;
case kFMXT_ScriptPaused:
{ // The user is running a script that is paused } break; case kFMXT_ScriptRunning: { // The user is running a script } break; case kFMXT_Unsafe: { // The plug-in should wait and do nothing at this time. } break; }// switch idleLevel } } // Do_PluginIdle