I would like to launch an executable file (.exe) on Windows 8, from OpenHAB, when an item (in my case, “nbState”) gets a particular value (in my case, 5).
This is my item configuration:
Number nbState {exec=">[5:START “MyProgram” “C:\Path\MyProgram.exe”]"}
But it doesn’t work.
Does the exec binding work on Windows?
If yes, what is the right syntax?
I guess shutdown is a windows command.
Do you have a rule where you launch your own .exe file?
I use START because I need my executable program to remain being executed. It is not a program that does one particular thing and closes. It needs to be continuosly running.
I am trying to find the difference between your working configuration and mine…
I don’t think I need to change the item to a Switch item.
I guess Number it’s ok, isn’t it?
Mhhh …sorry; not an expert either. I use autostart for things that need to run always (e.g. TTS utility) and windows scheduled jobs to call things I need to run e.g. every 5 minutes (update calendar items from google calendar). The closest I found on my system is a place where I call a .bat file (I did add the path to the environment variable of windows):
Dont’t know about the number …try the switch as a first (as I know that works); then once that’s sorted out you may change/verify that is works with a number as well.
-change the .exe to a .bat file
-keep the .exe syntax
-add the folder to system path
-change the item from Number to Switch.
-try the new syntax {exec=">[ON:MyProgram.bat]"}
-try the old syntax {exec=“ON:MyProgram.bat”}
Nothing works.
Are you using Windows 8.1?
I don’t understand what I am doing wrong…
1- System path change wasn’t being taken into account by OpenHAB
2- Antivirus blocked the execution of the program (silently!!)
3- The program was executed from the OpenHAB directory, and when it was launched, it didn’t find the proper config file.
Solution:
1- Restart the computer
2- Add an exception in the Antivirus
3- Create a .bat file that goes to the right directory, and then launches the program.