Rank: Member
Groups: Approved
Joined: 12/2/2019(UTC) Posts: 16
Thanks: 2 times
|
Hi
Could anyone please create a script which enables/disables the touch screen with a hotkey?
Thanks
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,308  Location: Tampa, FL Thanks: 28 times Was thanked: 410 time(s) in 351 post(s)
|
|
|
|
|
Rank: Member
Groups: Approved
Joined: 12/2/2019(UTC) Posts: 16
Thanks: 2 times
|
So, these commands work for me
pnputil /disable-device "HID\ELAN9009&COL01\5&8EBB0E5&0&0000" pnputil /enable-device "HID\ELAN9009&COL01\5&8EBB0E5&0&0000"
How do I call them from S+?
And how to check the device status to find out which command to run (disable or enable)?
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,308  Location: Tampa, FL Thanks: 28 times Was thanked: 410 time(s) in 351 post(s)
|
So this should work, however to enable or disable a device requires elevated privileges (which makes sense), so you will get a UAC prompt. Code:// Check the status of the device
var p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "C:\\Windows\\System32\\pnputil.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = '/enum-devices /instanceid "HID\\ELAN9009&COL01\\5&8EBB0E5&0&0000"';
p.Start();
var output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
var deviceEnabled = output.includes('Status: Started');
// Toggles enable/disable device
// Has to be run as admin, though (UAC promt)
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.UseShellExecute = true;
p.StartInfo.Verb = "runas";
p.StartInfo.FileName = "C:\\Windows\\System32\\cmd.exe";
p.StartInfo.Arguments = `/C pnputil.exe /${deviceEnabled ? 'disable' : 'enable'}-device /instanceid "HID\\ELAN9009&COL01\\5&8EBB0E5&0&0000"`;
p.Start();
|
|
|
|
Rank: Member
Groups: Approved
Joined: 12/2/2019(UTC) Posts: 16
Thanks: 2 times
|
Had to fix something and then it worked. Thank you!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close