Reputation: 1553
I know what the first response will be but my requirement is minimal and writing a script for that would be an overkill. All I want is to run a system command and send its output to the extension.
Here is what I have tried
@echo off
:strt
:: my code
goto strt
Doesn't work. The above code give me an error message Error when communicating with the native messaging host.
Following example Here
Upvotes: 1
Views: 1654
Reputation: 1553
It turns out that .bat
doesn't fulfil requirements for chrome native messaging host . My requirement from host was simple and using either python or c++ would be too much.I have opted for powershell
to accomplish the task.
here is the powershell
version
try {
$reader = New-Object System.IO.BinaryReader([System.Console]::OpenStandardInput())
$len = $reader.ReadInt32()
$buf = $reader.ReadBytes($len)
$msg = [System.Text.Encoding]::UTF8.GetString($buf)
$nets = ConvertFrom-Csv (getmac /fo CSV /v)
..
..
..
# you get the point.
Response @{mac = $mac} }
Answering my own question and hoping it would help someone in future.
Upvotes: 1