Can i send javascript to browser with OH?

Hi, I need to control my browser, mainly for youtube

found this

but I am having trouble understanding how to use such scripts with OH
i have Exec working and sending windows CMD commands, is there any way
to let’s say send mute or send stop when the browser already running?

thanks!

No, it doesn’ t work like that. When you open a web page, the web page runs is a sandbox. All the JavaScript that executes in that page has to be a part of that web page in the first place. You can inject JavaScript code or call JavaScript code from some other program and insert it into a page you already have loaded.

Perhaps you could write a browser extension that can inject JavaScript into a web page and listens for commands from outside of the browser, but I suspect that wouldn’t be allowed. It’d be a huge security problem.

You can’t use scripts like that with OH.

thanks Rich :frowning:
i guess i will use another method

do you know Player that can work with CMD ?
i am trying to do an alram system , also to send other voice commands to the house
so maybe i will use exec just to play stop and things like that…

On Linux there are several audio players. On Windows :man_shrugging:

Simple solution that works. If you just want to play some sound snippets you can also play via openHAB of course.

Thanks, i tried going that way also
i am getting errors from the voice services
Pico and google

i guess i did not configure it right
i tried to use
smarthome:voice say Hello world!
17:05:10.248 [pipe-smarthome:voice say Hello world!] ERROR org.eclipse.smarthome.io.console.ConsoleInterpreter - An error occurred while executing the console command.
java.util.NoSuchElementException: null
at java.util.ArrayList$Itr.next(ArrayList.java:854) ~[?:?]
at org.eclipse.smarthome.core.voice.internal.VoiceManagerImpl.getPreferredVoice(VoiceManagerImpl.java:439) ~[?:?]
at org.eclipse.smarthome.core.voice.internal.VoiceManagerImpl.say(VoiceManagerImpl.java:192) ~[?:?]
at org.eclipse.smarthome.core.voice.internal.VoiceManagerImpl.say(VoiceManagerImpl.java:154) ~[?:?]