Detect touch hardware using VBScript











up vote
0
down vote

favorite
1












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










share|improve this question
























  • 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















up vote
0
down vote

favorite
1












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










share|improve this question
























  • 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













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





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










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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










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.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    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

























    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.






    share|improve this answer

























      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.






      share|improve this answer























        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 at 10:27









        shawn

        865




        865






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Plaza Victoria

            In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

            How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...