Windows: getMonitors() return value
DefinitelyMaybe opened this issue · 12 comments
Firstly, cool work! I had a quick look into the 'Writing Deno Plugins' issue, and it sounds like everything works really nicely together.
Describe the bug
Played around with printing some of the return values. getMonitors() returned 1
but I have 2
monitors. small thing. No idea how, or where, or why. Can test later if you wish.
To Reproduce
console.log(pilot.getMonitors())
- See 1 instead of 2
Expected behavior
Expected 2
got 1
.
Desktop (please complete the following information):
- OS: Windows
@DefinitelyMaybe This usually happens when Autopilot fails to detect the number of monitors and as a fallback return 1
.
Could you try running the below code as a batch file? It should output Monitors: 2
for /F %%M in ('
wmic path Win32_PnPEntity where "Service='monitor' and Status='OK'" get DeviceID /VALUE ^
^| find /C "="
') do echo Monitors: %%M
find: ‘C’: No such file or directory
find: ‘=’: No such file or directory
Sorry, I don't know enough about batch files to adjust the script to get it to run correctly.
@DefinitelyMaybe So the script is probably broken and this is why it fails and fallbacks to 1.
I don't have access to Windows but I'll try to look into the issue.
@DefinitelyMaybe Could you try running it outside the batch file (in the cmd itself).
still same thing. added a pause statement, ran from cmd.exe, same error as above.
for /F %%M in ('
wmic path Win32_PnPEntity where "Service='monitor' and Status='OK'" get DeviceID /VALUE ^
^| find /C "="
') do echo Monitors: %%M
pause
for /F %M in (' wmic path Win32_PnPEntity where "Service='monitor' and Status='OK'" get DeviceID /VALUE | find /C "=" ') do echo Monitors: %M
find: '/C': No such file or directory
find: '=': No such file or directory
Make sure find.exe is available from cmd by typing find
.
Also, how are you running the batch file? Autopilot runs it like this cmd /C monitors.bat
@DefinitelyMaybe I tried it on Windows 64-bit.
This is probably a problem with the find command itself. I'm planning to remove it from the batchfile.
This should output the list of monitors available(without the use of find):
for /F %%M in ('
wmic path Win32_PnPEntity where "Service='monitor' and Status='OK'" get DeviceID /VALUE
') do echo Monitors: %%M
@DefinitelyMaybe The second screen shot prints a lot of echos into the terminal.
These are monitor details. It found 2 monitors.
Monitors: DeviceID:DISPLAY\DELD011....
Monitors: DeviceID:DISPLAY\SAM0B42....
This proves that the command works without find. I've also found an issue with the batch file not being executed by autopilot. Will fix it in the next release.
@DefinitelyMaybe Looks like it is fixed. Also, .getMonitors
returns a promise now.
console.log(await pilot.getMonitors());
(Don't forget to use reload --reload
to download the latest version.)
@DefinitelyMaybe Leaving upto you to close this issue if it's solved.