GoyaPtyLtd / BaseElements-Plugin

FileMaker Pro plugin used for BaseElements to provide file, dialog and XSLT functions.
http://www.goya.com.au/baseelements/plugin
154 stars 51 forks source link

Installed script step not appearing #210

Open nvcleemp opened 2 years ago

nvcleemp commented 2 years ago

This is probably more a support question than an actual issue, but I can't figure out how to use the BE_ScriptStepInstall function, and the documentation is not really helpful.

As an example I'm simply trying to make a script step to perform BE_DialogProgress.

I have tried:

BE_ScriptStepInstall ( "Show Progress Dialog" ; "<PluginStep><Parameter ID=\"0\" Type=\"Calc\" DataType=\"Text\" ShowInline=\"true\" Label=\"Title\"/><Parameter ID=\"1\" Type=\"Calc\" DataType=\"Text\" ShowInline=\"true\" Label=\"Description\"/><Parameter ID=\"2\" Type=\"Calc\" DataType=\"Number\" ShowInline=\"true\" Label=\"Maximum\"/></PluginStep>" ; 901 ; "Show a progress dialog" ; "BE_DialogProgress ( \"###0###\" ; \"###1###\" ; \"###2###\" )" )

and I have tried:

BE_ScriptStepInstall ( "Show Progress Dialog" ; "<PluginStep><Parameter ID=\"0\" Type=\"Calc\" DataType=\"Text\" ShowInline=\"true\" Label=\"Title\"/><Parameter ID=\"1\" Type=\"Calc\" DataType=\"Text\" ShowInline=\"true\" Label=\"Description\"/><Parameter ID=\"2\" Type=\"Calc\" DataType=\"Number\" ShowInline=\"true\" Label=\"Maximum\"/></PluginStep>" ; 901 ; "Show a progress dialog" ; "BE_DialogProgress ( ###0### ; ###1### ; ###2### )" )

Neither seem to be working. They also don't produce an error and I can see the script step in BE_DebugInformation.

Speaking of which... this is the output of BE_DebugInformation:

{
 "Curl Information" : {
  "Curl Options" : {
  },
  "Custom HTTP Headers" : {
  },
  "Custom SMTP Headers" : {
  },
  "HTTP Proxy Information" : {
   "Password" : "",
   "Port" : "",
   "Server" : "",
   "Username" : ""
  },
  "HTTP Response Code" : 0,
  "HTTP Response Headers" : "",
  "SMTP Attachments" : {
  },
  "SMTP Server Information" : {
   "Password" : "",
   "Port" : "",
   "Server" : "",
   "Username" : ""
  },
  "Trace" : ""
 },
 "Date" : "Wed Jun 15 15:29:14 2022",
 "FileMaker Information" : {
  "Application" : 1,
  "File ID" : 3,
  "Session ID" : 1,
  "Version" : "Pro 19.4.2"
 },
 "Last DDL Error" : 0,
 "Last Error" : 0,
 "Plugin Information" : {
  "Auto Update Version" : "04020400",
  "Version" : "4.2.4"
 },
 "Script Steps" : {
  "" : 852,
  "BE_DialogProgress ( \"###0###\" ; \"###1###\" ; \"###2###\" )" : 901
 },
 "Text Encoding" : "UTF-8"
}
nickorr commented 2 years ago

Ok, so you do need to quote the text strings when you setup the function, so this is the example I tried :

BE_ScriptStepInstall ( "Show Progress Dialog" ; 

"<PluginStep>
    <Parameter ID=\"0\" Type=\"Calc\" DataType=\"Text\" ShowInline=\"true\" Label=\"Title\"/>
    <Parameter ID=\"1\" Type=\"Calc\" DataType=\"Text\" ShowInline=\"true\" Label=\"Description\"/>
    <Parameter ID=\"2\" Type=\"Calc\" DataType=\"Number\" ShowInline=\"true\" Label=\"Maximum\"/>
    </PluginStep>"

     ; 1 ; "Show a progress dialog" ; "BE_DialogProgress ( \"###0###\" ; \"###1###\" ; \"###2###\" )" 

 )

Which works to create the script step ( you need to close and re-open the editor for it to appear ).

However when I run the step I get error -1. I'm looking into this one now.

Cheers, Nick

nickorr commented 2 years ago

Followup, that did work for me, the progress dialog appeared, just behind another window so I didn't see it at first. But I got the extra error dialog as well...

nvcleemp commented 2 years ago

Hi Nick

Thanks. Closing and reopening the editor was the step that was missing. In hindsight, probably a logical step to take, but I think I just closed the whole database once, and didn't try to close just the editor afterwards.

I didn't get an error dialog, and the progress dialog appeared in the foreground. Anyway, this was just a proof of concept I was building, and I took the progress dialog because it would have given me immediate visual feedback to see whether the script step was successfully executed.

Maybe it is a good idea to include a small example of this functionality in the documentation as well as note that the editor window needs to be restarted.

Thanks a bunch!

Cheers Nico

nickorr commented 2 years ago

So you don't get the same error dialog that I did? What platform and what versions of everything ( OS, FMP, BE )

Thanks, Nick

nvcleemp commented 2 years ago

No, I don't get an error dialog, and I even checked with Get ( LastError ) and BE_GetLastError: no errors are raised.

This is my setup:

{
 "Curl Information" : {
  "Curl Options" : {
  },
  "Custom HTTP Headers" : {
  },
  "Custom SMTP Headers" : {
  },
  "HTTP Proxy Information" : {
   "Password" : "",
   "Port" : "",
   "Server" : "",
   "Username" : ""
  },
  "HTTP Response Code" : 0,
  "HTTP Response Headers" : "",
  "SMTP Attachments" : {
  },
  "SMTP Server Information" : {
   "Password" : "",
   "Port" : "",
   "Server" : "",
   "Username" : ""
  },
  "Trace" : ""
 },
 "Date" : "Fri Jun 24 13:00:42 2022",
 "FileMaker Information" : {
  "Application" : 1,
  "File ID" : 17,
  "Session ID" : 1,
  "Version" : "Pro 19.5.1"
 },
 "Last DDL Error" : 0,
 "Last Error" : 0,
 "Plugin Information" : {
  "Auto Update Version" : "04020400",
  "Version" : "4.2.4"
 },
 "Script Steps" : {
  "BE_DialogProgress ( \"###0###\" ; \"###1###\" ; \"###2###\" )" : 901
 },
 "Text Encoding" : "UTF-8"
}