Execute a custom script using a button or form

Hi Team

We were discussing some of the scripting needs with some computational scientists and we came across a use-case, where they would like to expose a button and additional input forms to end-users, which will then trigger a custom script.

So for instance filling in some parameters, select some rows and then run a script by clicking a button.
Currently, I only know about the panel, where you can build custom UI components as part of a custom script, but the panel is displayed in the context of a specific value (like e.g. a structure, the user clicked on).

Is it also possible to show such custom UI components - coming from a custom script - for e.g. a set of selected rows?

Thanks
Nico

Hi Nico

You can create stand-alone scripts inside Datagrok. There is an example of a script with standard form: Heat exchange. Another UI may be used for more sophisticated scripts: Object cooling. Right-click on the script card and click on the “Run” option. Is it something you looking for?

Best regards,
Aufar

1 Like

These scripts may be written using any supported language. They only should have special headers. Headers provide hints for a platform on the inputs and outputs of the script. These hints are used to automatically create a GUI for your scripts - including input forms (with validations, tooltips, etc.) and output UI. This way, there will be no GUI coding - only configuration of it using headers.

1 Like

Such scripts may be created manually in the web interface. I would recommend you step-by-step instructions to learn how to do it. After that, you may be interested in formal syntax.

Please reply to this topic if you have any trouble with creating or using scripts.

1 Like

There are few options:

  • custom function editors (a custom component that edits the properties of the FuncCall)
  • custom field editors
  • wrap your Python script in a JS function, which would have complete control of the way it is invoked, how the UI is built, and how results are generated.

I will provide more links to the corresponding help sections a bit later…

1 Like

Thanks, Andrew.

Would be curious to hear more about the custom field editors.