Help! How to run Running a batch file running on windows 10


just need a basic way to run a batch file on hapanel i have tired with chartgpt but i dont really understand it as im new to openhab

Create a script in the GUI and add this to your JS script:

var result = actions.Exec.executeCommandLine(Duration.ofSeconds(2),"C:\\test.bat");

HI where am i adding this

Have a look at the documentation how to create file-based rules/scripts. How do you want the rule to be triggered?
If you are new to openHAB, please consider to use the built-in GUI „MainUI“ instead of habpanel. Habpanel is not being developed further

Look i have no idea what they are talking about this my first trying to adding batch files i just want someone to go thought it step by step becosue i have no idea

Start your browser, navigate to IpaddressOfYourServer:8080, log in, goto Settings - scripts and create a script. Choose ECMA and add the code above (make sure that you have installed JS scripting which you can do under Settings - automation. On the bottom, there is a button „play“ which starts your code.
You can see thecresults in the log file under IpaddressOfYourServer:9001

as long as frontail is installed and running under Windows.

have put then under ecma

var result = actions.Exec.executeCommandLine(Duration.ofSeconds(2),“C:\openhab-3.4.4\Wolcmd\WOL.Bat”);

but docent seem to work

it needs to be:

incl. double backslashes

getting this 2023-08-29 20:16:44.686 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘35da051ab2’ failed: org.graalvm.polyglot.PolyglotException: ReferenceError: “Duration” is not defined

var result = actions.Exec.executeCommandLine(time.Duration.ofSeconds(2),"C:\\test.bat");

2023-08-29 20:33:49.641 [WARN ] [] - Timeout occurred when executing commandLine ‘[C:\test.bat]’

have renamed my batch file to test

Ok. Then we might run into a known problem.
Starting a batch file under Windows does only work as long as it does not start GUI-based apps as Rich described here
Do you launch GUI apps with your .bat file?

cd C:\openhab-3.4.4\wolcmd
WolCmd 74:46:A0:92:64:21

this what is the batch file

On the just batch file to do wake on lan

I assume the wolcmd waits until the device woke up. Please adjust the timeout value (time.Duration.ofSeconds(2)) accordingly

But when I run that script in windows open for sec and close then my pic turn so no sure


have now made the time.Duration.ofSeconds 20 and now is working are you able to assist me adding tthis to hapanel

Sorry, no, I have no experience with Habpanel.
Why did you decide for habpanel? There is almost no support anymore for this old GUI.