0

I am trying a test addon on mozilla that uses sendNativeMessage(). This addon sends a "ping" string to a .bat file. I am trying to get the input and redirect it to a file.txt. Sadly, all i get is a "strange square" char into the file.txt.

How can i get that stdio input coming from the addon into the batch file please ?

Native Message (addon.js):

let sending = browser.runtime.sendNativeMessage("ping_pong", "ping");

The ping_pong.json pointed by ping_pong :

{
"name": "ping_pong",
"description": "Example host for native messaging",
"path": "PATH_TO_BATCH\\app.cmd",
"type": "stdio",
"allowed_extensions": [ "Messaging_Test@API" ]
}

Batch file :

@echo off
chcp 65001
set /p message=
echo %message%>"file.txt"

PS : echo %*>file.txt returns PATH_TO_JSON\ping_pong.json Messaging_Test@API instead of (i guess) ping

Also, this link shows that its using %* into the .cmd to send to python. So i don't understand why i can't just handle the %* straight into the batch file. Native example bat docs

Thank you

0

0