Detect touch hardware using VBScript
up vote
0
down vote
favorite
I am looking for a way to detect installed touch hardware using VBScript. My script doesn't work.
This script is intended to look for a pointing device and echo accordingly.
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PointingDevice")
For Each objItem In colItems
TouchDevice = objItem.PointingType
if TouchDevice = 8 then
Wscript.Echo "Found touch based hardware"
WScript.Echo "=========================================="
Else
Wscript.Echo "No Touch based hardware found"
WScript.Echo "=========================================="
End If
Next
Computer : Dell 15R 5537 Touchscreen Laptop with windows 8 Enterprise.
Pointing Device : Touch Screen, mouse, Touch Pad
How I run the script: Double click the .vbs file or run it via Command Prompt
What happens: As per my script, if TouchDevice == objItem.PointingType == 8, it should output that touch hardware was found but it keeps outputting no touch hardware found.
Reference : WMI Class win32_PointingDevice
windows-8 script vbscript wmi
|
show 1 more comment
up vote
0
down vote
favorite
I am looking for a way to detect installed touch hardware using VBScript. My script doesn't work.
This script is intended to look for a pointing device and echo accordingly.
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PointingDevice")
For Each objItem In colItems
TouchDevice = objItem.PointingType
if TouchDevice = 8 then
Wscript.Echo "Found touch based hardware"
WScript.Echo "=========================================="
Else
Wscript.Echo "No Touch based hardware found"
WScript.Echo "=========================================="
End If
Next
Computer : Dell 15R 5537 Touchscreen Laptop with windows 8 Enterprise.
Pointing Device : Touch Screen, mouse, Touch Pad
How I run the script: Double click the .vbs file or run it via Command Prompt
What happens: As per my script, if TouchDevice == objItem.PointingType == 8, it should output that touch hardware was found but it keeps outputting no touch hardware found.
Reference : WMI Class win32_PointingDevice
windows-8 script vbscript wmi
i wasn't sure how to do it earlier, now i just need to make sure i am doing it right !.
– pun
Nov 27 '14 at 20:06
Is your objective simply to detect the presence of any touch-based pointing device and report whether or not one was found? It would be more appropriate to wait until you have the device and try it. If it doesn't work, there would be a basis to diagnose the problem. It is difficult for someone to look at a script and envision any and all theoretical problems it might have. The script could have some subtle error that doesn't get noticed but a failure would make it obvious. You are basically asking for opinion at this stage, which isn't consistent with the site's objectives.
– fixer1234
Nov 27 '14 at 22:22
This script does not work. It failed to detect touch screen. Can i get some directions now ?
– pun
Dec 4 '14 at 5:19
Can you provide some supplementary information? computer model and OS? Pointing device? How do you run the script? What happens when you run the script?
– fixer1234
Dec 4 '14 at 5:24
Did you confirm that your device indeed reports the value 8? I tried this on a lenovo win8 tablet and it will report 2 (=unknown) as value for PointingType
– Syberdoor
Jan 2 '15 at 14:36
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am looking for a way to detect installed touch hardware using VBScript. My script doesn't work.
This script is intended to look for a pointing device and echo accordingly.
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PointingDevice")
For Each objItem In colItems
TouchDevice = objItem.PointingType
if TouchDevice = 8 then
Wscript.Echo "Found touch based hardware"
WScript.Echo "=========================================="
Else
Wscript.Echo "No Touch based hardware found"
WScript.Echo "=========================================="
End If
Next
Computer : Dell 15R 5537 Touchscreen Laptop with windows 8 Enterprise.
Pointing Device : Touch Screen, mouse, Touch Pad
How I run the script: Double click the .vbs file or run it via Command Prompt
What happens: As per my script, if TouchDevice == objItem.PointingType == 8, it should output that touch hardware was found but it keeps outputting no touch hardware found.
Reference : WMI Class win32_PointingDevice
windows-8 script vbscript wmi
I am looking for a way to detect installed touch hardware using VBScript. My script doesn't work.
This script is intended to look for a pointing device and echo accordingly.
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PointingDevice")
For Each objItem In colItems
TouchDevice = objItem.PointingType
if TouchDevice = 8 then
Wscript.Echo "Found touch based hardware"
WScript.Echo "=========================================="
Else
Wscript.Echo "No Touch based hardware found"
WScript.Echo "=========================================="
End If
Next
Computer : Dell 15R 5537 Touchscreen Laptop with windows 8 Enterprise.
Pointing Device : Touch Screen, mouse, Touch Pad
How I run the script: Double click the .vbs file or run it via Command Prompt
What happens: As per my script, if TouchDevice == objItem.PointingType == 8, it should output that touch hardware was found but it keeps outputting no touch hardware found.
Reference : WMI Class win32_PointingDevice
windows-8 script vbscript wmi
windows-8 script vbscript wmi
edited Dec 4 '14 at 5:45
fixer1234
17.4k144281
17.4k144281
asked Nov 24 '14 at 4:50
pun
4,80081851
4,80081851
i wasn't sure how to do it earlier, now i just need to make sure i am doing it right !.
– pun
Nov 27 '14 at 20:06
Is your objective simply to detect the presence of any touch-based pointing device and report whether or not one was found? It would be more appropriate to wait until you have the device and try it. If it doesn't work, there would be a basis to diagnose the problem. It is difficult for someone to look at a script and envision any and all theoretical problems it might have. The script could have some subtle error that doesn't get noticed but a failure would make it obvious. You are basically asking for opinion at this stage, which isn't consistent with the site's objectives.
– fixer1234
Nov 27 '14 at 22:22
This script does not work. It failed to detect touch screen. Can i get some directions now ?
– pun
Dec 4 '14 at 5:19
Can you provide some supplementary information? computer model and OS? Pointing device? How do you run the script? What happens when you run the script?
– fixer1234
Dec 4 '14 at 5:24
Did you confirm that your device indeed reports the value 8? I tried this on a lenovo win8 tablet and it will report 2 (=unknown) as value for PointingType
– Syberdoor
Jan 2 '15 at 14:36
|
show 1 more comment
i wasn't sure how to do it earlier, now i just need to make sure i am doing it right !.
– pun
Nov 27 '14 at 20:06
Is your objective simply to detect the presence of any touch-based pointing device and report whether or not one was found? It would be more appropriate to wait until you have the device and try it. If it doesn't work, there would be a basis to diagnose the problem. It is difficult for someone to look at a script and envision any and all theoretical problems it might have. The script could have some subtle error that doesn't get noticed but a failure would make it obvious. You are basically asking for opinion at this stage, which isn't consistent with the site's objectives.
– fixer1234
Nov 27 '14 at 22:22
This script does not work. It failed to detect touch screen. Can i get some directions now ?
– pun
Dec 4 '14 at 5:19
Can you provide some supplementary information? computer model and OS? Pointing device? How do you run the script? What happens when you run the script?
– fixer1234
Dec 4 '14 at 5:24
Did you confirm that your device indeed reports the value 8? I tried this on a lenovo win8 tablet and it will report 2 (=unknown) as value for PointingType
– Syberdoor
Jan 2 '15 at 14:36
i wasn't sure how to do it earlier, now i just need to make sure i am doing it right !.
– pun
Nov 27 '14 at 20:06
i wasn't sure how to do it earlier, now i just need to make sure i am doing it right !.
– pun
Nov 27 '14 at 20:06
Is your objective simply to detect the presence of any touch-based pointing device and report whether or not one was found? It would be more appropriate to wait until you have the device and try it. If it doesn't work, there would be a basis to diagnose the problem. It is difficult for someone to look at a script and envision any and all theoretical problems it might have. The script could have some subtle error that doesn't get noticed but a failure would make it obvious. You are basically asking for opinion at this stage, which isn't consistent with the site's objectives.
– fixer1234
Nov 27 '14 at 22:22
Is your objective simply to detect the presence of any touch-based pointing device and report whether or not one was found? It would be more appropriate to wait until you have the device and try it. If it doesn't work, there would be a basis to diagnose the problem. It is difficult for someone to look at a script and envision any and all theoretical problems it might have. The script could have some subtle error that doesn't get noticed but a failure would make it obvious. You are basically asking for opinion at this stage, which isn't consistent with the site's objectives.
– fixer1234
Nov 27 '14 at 22:22
This script does not work. It failed to detect touch screen. Can i get some directions now ?
– pun
Dec 4 '14 at 5:19
This script does not work. It failed to detect touch screen. Can i get some directions now ?
– pun
Dec 4 '14 at 5:19
Can you provide some supplementary information? computer model and OS? Pointing device? How do you run the script? What happens when you run the script?
– fixer1234
Dec 4 '14 at 5:24
Can you provide some supplementary information? computer model and OS? Pointing device? How do you run the script? What happens when you run the script?
– fixer1234
Dec 4 '14 at 5:24
Did you confirm that your device indeed reports the value 8? I tried this on a lenovo win8 tablet and it will report 2 (=unknown) as value for PointingType
– Syberdoor
Jan 2 '15 at 14:36
Did you confirm that your device indeed reports the value 8? I tried this on a lenovo win8 tablet and it will report 2 (=unknown) as value for PointingType
– Syberdoor
Jan 2 '15 at 14:36
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
0
down vote
Unfortunately, as you've seen, the win32_PointingDevice structure isn't used correctly.
You can still do it though, by parsing the win32_PnPEntity instead for "touch".
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity")
For Each objItem In colItems
If InStr(1, objItem.Description , "touch", 1) > 0 Then
Wscript.Echo "Found touch based hardware: " & objItem.PnPDeviceID
WScript.Echo "=========================================="
End If
Next
This does pretty much the same thing as your sample attempt but looks at the object description of every PnP device for the word "touch" and lists that object.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Unfortunately, as you've seen, the win32_PointingDevice structure isn't used correctly.
You can still do it though, by parsing the win32_PnPEntity instead for "touch".
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity")
For Each objItem In colItems
If InStr(1, objItem.Description , "touch", 1) > 0 Then
Wscript.Echo "Found touch based hardware: " & objItem.PnPDeviceID
WScript.Echo "=========================================="
End If
Next
This does pretty much the same thing as your sample attempt but looks at the object description of every PnP device for the word "touch" and lists that object.
add a comment |
up vote
0
down vote
Unfortunately, as you've seen, the win32_PointingDevice structure isn't used correctly.
You can still do it though, by parsing the win32_PnPEntity instead for "touch".
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity")
For Each objItem In colItems
If InStr(1, objItem.Description , "touch", 1) > 0 Then
Wscript.Echo "Found touch based hardware: " & objItem.PnPDeviceID
WScript.Echo "=========================================="
End If
Next
This does pretty much the same thing as your sample attempt but looks at the object description of every PnP device for the word "touch" and lists that object.
add a comment |
up vote
0
down vote
up vote
0
down vote
Unfortunately, as you've seen, the win32_PointingDevice structure isn't used correctly.
You can still do it though, by parsing the win32_PnPEntity instead for "touch".
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity")
For Each objItem In colItems
If InStr(1, objItem.Description , "touch", 1) > 0 Then
Wscript.Echo "Found touch based hardware: " & objItem.PnPDeviceID
WScript.Echo "=========================================="
End If
Next
This does pretty much the same thing as your sample attempt but looks at the object description of every PnP device for the word "touch" and lists that object.
Unfortunately, as you've seen, the win32_PointingDevice structure isn't used correctly.
You can still do it though, by parsing the win32_PnPEntity instead for "touch".
On Error Resume Next
strComputer = "."
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity")
For Each objItem In colItems
If InStr(1, objItem.Description , "touch", 1) > 0 Then
Wscript.Echo "Found touch based hardware: " & objItem.PnPDeviceID
WScript.Echo "=========================================="
End If
Next
This does pretty much the same thing as your sample attempt but looks at the object description of every PnP device for the word "touch" and lists that object.
answered Nov 21 at 10:27
shawn
865
865
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f844192%2fdetect-touch-hardware-using-vbscript%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
i wasn't sure how to do it earlier, now i just need to make sure i am doing it right !.
– pun
Nov 27 '14 at 20:06
Is your objective simply to detect the presence of any touch-based pointing device and report whether or not one was found? It would be more appropriate to wait until you have the device and try it. If it doesn't work, there would be a basis to diagnose the problem. It is difficult for someone to look at a script and envision any and all theoretical problems it might have. The script could have some subtle error that doesn't get noticed but a failure would make it obvious. You are basically asking for opinion at this stage, which isn't consistent with the site's objectives.
– fixer1234
Nov 27 '14 at 22:22
This script does not work. It failed to detect touch screen. Can i get some directions now ?
– pun
Dec 4 '14 at 5:19
Can you provide some supplementary information? computer model and OS? Pointing device? How do you run the script? What happens when you run the script?
– fixer1234
Dec 4 '14 at 5:24
Did you confirm that your device indeed reports the value 8? I tried this on a lenovo win8 tablet and it will report 2 (=unknown) as value for PointingType
– Syberdoor
Jan 2 '15 at 14:36