Using a script Action in the Paper UI rule editor

OpenHab 2.54
New Rules Enginer 2.54
Linux Mint 19

Sorry this seems such a simple question but I have spent 4+ hours trying to call a test.script from the New Rules Engine with no luck.

I have create a testrule in PapeerUI with No When just a simple call script in the then clause. I am trying to call a test.script when I manually run the rule.

My test.script is very simple with just
say (“Hello World”)

But it looks like the script cannot be run for some reason, see error from log below:-

020-05-05 21:39:11.528 [ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: :1:13 Unsupported RegExp flag: c
/OpenHab/conf/scripts/test.script

I have tried various paths with and without the .script extension but have been unable to find a solution to run the script.

What is the correct way of defining the script name in the New Rule Engine ?

regards
Kevin

When you use ‘execute a given script’ for the Action…

… you need to select the Script Type from the available ScriptEngineFactories and then enter the actual script into the editor. This action does not read script files and it does not work with rule DSL scripts.

Read through this series of tutorials, but you will be much better off using scripted automation until the UI is built out in OH 3.0…

1 Like

Many thanks for the clarity , I had thought it called a script file rather than having the script embeded in the rule. I will investigate further but it would be a good way of supporting those with existing scripts if it were possible to run scripts from the /conf/script folder. Scripts could then be written with the help of Visual Studio Code for syntax etc.

Many thanks for the documentation link I had not come across this one in my search !

Kevin

You can use script files, just not in the UI rule editor. There is a lot more documentation here…

https://openhab-scripters.github.io/openhab-helper-libraries/index.html