Other Tips
From FM Plugin Wikipedia
Contents |
This page is about editing and working with the Calc Engine, Client and Types passed from FileMaker to your plugin.
Do_StartScript
The default FM 7 API includes the function 'Do_StartScript' works okay, but by default, it doesn't allow you to pass any text to the called script which can then be retrieved using 'Get(ScriptParameter)'
You can modify the script as below, which allows the user to pass an optional (in my case) third parameter, which is then passed to the called script.
FMX_PROC(fmx::errcode) Do_StartScript(short /* funcId */, const fmx::ExprEnv& /* environment */, const fmx::DataVect& dataVect, fmx::Data& /* results */ ) { fmx::errcode errorResult = 0; fmx::ulong nParams = dataVect.Size(); if (nParams > 2) { // This function will trigger the execution of a script in FileMaker Pro, passing the text as parameter to the script. errorResult = FMX_StartScript( &(dataVect.AtAsText(0)), &(dataVect.AtAsText(1)), kFMXT_Pause, &(dataVect.At(2)) ); } else if (nParams > 1) { // This function will trigger the execution of a script in FileMaker Pro with no paramater. errorResult = FMX_StartScript( &(dataVect.AtAsText(0)), &(dataVect.AtAsText(1)), kFMXT_Pause, NULL ); } else { errorResult = -1; // This is just an example of returning an error }// nParams > 1 return(errorResult); } // Do_IDMA_StartScript