todbot / Blink1Control2

Blink1Control GUI to control blink(1) USB RGB LED devices.
http://blink1.thingm.com/
Apache License 2.0
154 stars 24 forks source link

Windows: cannot use PowerShell scripts as Script event source? #95

Open todbot opened 6 years ago

todbot commented 6 years ago

It seems like I cannot. Need to investigate. The error is "spawn UNKNOWN" in the event status.

todbot commented 6 years ago

See: https://stackoverflow.com/questions/10179114/execute-powershell-script-from-node-js

todbot commented 6 years ago

Also, scripts should perhaps be 'cwd'd to the directory the script is in.

todbot commented 6 years ago

One workaround is to create a CMD batch file and use:

for /f %%i in ('powershell -File %~dp0\lockstate-get.ps1') do set lockstate=%%i

To get the output of a Powershell script into a CMD batch file variable. For more details see: https://github.com/todbot/blink1/blob/master/windows/scripts/lockstate-get.ps1 https://github.com/todbot/blink1/blob/master/windows/scripts/lockstate-test.bat