Starting a .bat/.jar from rule

Hi all,

for a kind of monthly report that i want to add to a excel file i wrote a jar that gets all items via REST API then creates me a excel file. This .jar has to be executed via a .bat file else there will be pathing problems(relative paths).
My question is can i somehow create a rule that starts this .bat i wrote and then send te generated file to me via mail ?

Thanks

Have you looked at the Exec binding?

Sry for me taking so long to respond, tbh i forgot that i asked here since i got busy.

I’d like to hear you solution too.

I found the mistake in my code, it seems that i forgot the execution time of my bat and so on and that the rule got executed faster than my script.

import java.util.List

rule "report"
when
	Item executereport received command ON or
	Time cron " 0 0 0 1 * ?"
then
	executeCommandLine("~path~\report.bat",10000)
	val List<String> url = newArrayList("file:///~path~/reports.csv")
	sendMail("~emailadress~", "This is the email subject", "This is the email body", url)
end

adding ,10000 as argument for executeCommandLine solved the problem.

Thank you