AlbertMN / AssistantComputerControl

Control your computer with your Google Home or Amazon Alexa assistant!
MIT License
879 stars 61 forks source link

Can't run a .bat file that interacts with DisplaySwitch.exe #109

Closed SullieLore closed 3 years ago

SullieLore commented 3 years ago

I am trying to run:

@echo off start "" "%windir%\System32\DisplaySwitch.exe" /external

This .bat works when I run it myself (switches to 1 monitor). However, when I run it through IFTTT/ACC it gives me an error in the run box that Windows cannot find displayswitcher.exe.

Hardware & software info (please complete the following information):

SullieLore commented 3 years ago

image

AlbertMN commented 3 years ago

Will look at this tomorrow :)

AlbertMN commented 3 years ago

Getting same issue, only for exe seemingly. not txt or anything.

Sorry for the super late reply. Doing further testing.

AlbertMN commented 3 years ago

Ok, so the issue seems to be 32 vs 64 bit, as explained here; https://stackoverflow.com/a/38678712/4880538

Most likely your app is 32-bit, and in 64-bit Windows references to C:\Windows\System32 get transparently redirected to C:\Windows\SysWOW64 for 32-bit apps. calc.exe happens to exist in both places, while soundrecorder.exe exists in the true System32 only.

And DisplaySwitch.exe doesn't exist in the 64 bit space, I've also confirmed this in the code. Working on seeing if there's some way to fix it.

AlbertMN commented 3 years ago

Issue seemingly fixed by disabling the "Prefer 32 bit" option in visual studios. I also added the action display_switch so a custom batch file isn't needed, but it's native :) More info on that coming soon.

(The following parameters can be used; nothing to just show the display switcher, so you can click yourself, or "external", "internal", "extend", "clone" to automatically trigger the given mode)

AlbertMN commented 3 years ago

@SullieLore test version with the proposed fix here; https://github.com/AlbertMN/AssistantComputerControl/issues/115

SullieLore commented 3 years ago

Thanks for working on this! Great to hear the command is native now, as that is a better solution than messing with workarounds.