Sign in to follow this  
Followers 0
babou

number of key

6 posts in this topic

hello all

I could I know the number of keyboard key on my keyboard.

This is to know if it is a laptop computer or a desktop :)

thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Look at the registry keys here:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96B-E325-11CE-BFC1-08002BE10318}\001

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

So what happens when the laptop is docked and has an external keyboard plugged in?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This script will return the "Real" machine type:

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $strChassisTypes = $objItem.ChassisTypes(0)
      ;$Output = $Output & "ChassisTypes: " & $strChassisTypes & @CRLF
      $chassisString = ""
        Switch $strChassisTypes
            Case 1
                $chassisString = "Other"
            Case 2
                $chassisString = "Unknown"
            Case 3
                $chassisString = "Desktop"
            Case 4
                $chassisString = "Low Profile Desktop"
            Case 5
                $chassisString = "Pizza Box"
            Case 6
                $chassisString = "Mini Tower"
            Case 7
                $chassisString = "Tower"
            Case 8
                $chassisString = "Portable"
            Case 9
                $chassisString = "Laptop"
            Case 10
                $chassisString = "Notebook"
            Case 11
                $chassisString = "Handheld"
            Case 12
                $chassisString = "Docking Station"
            Case 13
                $chassisString = "All-in-One"
            Case 14
                $chassisString = "Sub-Notebook"
            Case 15
                $chassisString = "Space Saving"
            Case 16
                $chassisString = "Lunch Box"
            Case 17
                $chassisString = "Main System Chassis"
            Case 18
                $chassisString = "Expansion Chassis"
            Case 19
                $chassisString = "Sub-Chassis"
            Case 20
                $chassisString = "Bus Expansion Chassis"
            Case 21
                $chassisString = "Peripheral Chassis"
            Case 22
                $chassisString = "Storage Chassis"
            Case 23
                $chassisString = "Rack Mount Chassis"
            Case 24
                $chassisString = "Sealed-Case PC"
            Case Else
        EndSwitch
      if Msgbox(1,"WMI Output",$chassisString) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_SystemEnclosure" )
Endif

Converted from http://www.microsoft.com/technet/scriptcen...04/hey0921.mspx

Edited by weaponx

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

So what happens when the laptop is docked and has an external keyboard plugged in?

I believe the docked keyboard becomes instance \002 in that registry key, but I don't have one here to try it.

But your WMI check of the chassis type is more to the point anyway.

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0