<-- back to the index of Rosetta examples

hello world (popup window)

Create a new action hello() that prints "Hello world!" in a popup window.

Example implementations

awk | bash | lua | pl | py | rb | scm | stt | tcl

Explanation, step by step

Load packages the script depends on:

Create a function ev_action that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called.

When the action event is called, use dialog_report to pop up a report dialog. First argument donates the name (title) of the window, the second is the text printed in the window.

In the "main" section of the script, bind event ACTE_action to our local function ev_action - this gets ev_action to be called when any of the actions registered by this script is executed.

Finally use action_register to register the action: