[SOLVED] How to run VBS scripts on windows Machine

(Gad Ofir) #1

Hi i am runing OH on windows machine, can i use Exec to run VBS script on the pc that is runing OH?
also if anyone has any idea how to contorl VLC that is runing on that PC?

so lets say if want a full autuamted PC for movie or gaming needs

thanks allot!

0 Likes

(Rich Koshak) #2

If you can run it from the cmd prompt you can run it using exec. You may need to use full paths to things though.

0 Likes

(Gad Ofir) #3

i have tried to follow the guide but i dont get it,maybe becuse i am windows user :slight_smile:
i missing the thing i need to do in things file, if can please help me with syntex
i just want to be able to run simple script

lets say its on C:home.vbs

home.things
???

home.items
Switch YourTrigger

home.sitemap
Switch item=YourTrigger

by the way i was just on colordo springs!!! more in Lone tree

0 Likes

(Rich Koshak) #4

The full syntax with examples are in the README.

https://docs.openhab.org/v2.1/addons/bindings/exec/readme.html

I love this part of the country. I hope to never have to move away.

0 Likes

(Gad Ofir) #5

already been throgh all the guides :frowning:
still not able to make it run
and nothing in the logs

Items:
Switch YourTrigger { channel=“exec:command:myscript:run”}

things
Thing exec:command:myscript [command=“vbs ./conf/scripts/XGame.vbs %2$s”, interval=0, autorun=false ]

if you can please tell me what i am missing here

0 Likes

(Rich Koshak) #6

I really don’t use this binding and have never used it on windows.
What is in the logs when you trigger the item?

0 Likes

(Gad Ofir) #7

no error just the value changing from 1 to 0

0 Likes

(Rich Koshak) #8

Which logs are you looking at? You should be seeing lines in openhab.log that shows what the script is returning.

My last advice is to try How to solve Exec binding problems

0 Likes

(Gad Ofir) #9

Hi its working!

i will try to put here my wisdom :slight_smile:

  1. install Exec

  2. things file
    Thing exec:command:myscript [command=“amd”, interval=0, autorun=false ]

  3. Items
    number YourTrigger { channel=“exec:command:myscript:run”}

  4. the file is a VBS script compiled to EXE with a freeware

  5. put the file in C folder

  6. configre env varibles , so AMD file will run as native app
    https://superuser.com/questions/756969/how-to-add-new-application-to-run-from-command-prompt

  7. reboot all , windows and open hab for sure

  8. working for me if anyone needs help

Trouble shooting:

  1. if you are able to run calc with no issue you are on step 4
    Thing exec:command:myscript [command=“Calc”, interval=0, autorun=false ]

  2. if you are not able to run Calc i cannot help you for me exec worked OOB, only had issue with syntex and type of file i am runing

hopes this will help someone

0 Likes