babou Posted September 25, 2007 Share Posted September 25, 2007 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 25, 2007 Share Posted September 25, 2007 (edited) Look at the registry keys here: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96B-E325-11CE-BFC1-08002BE10318}\001 Edited September 25, 2007 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 Link to comment Share on other sites More sharing options...
weaponx Posted September 25, 2007 Share Posted September 25, 2007 So what happens when the laptop is docked and has an external keyboard plugged in? Link to comment Share on other sites More sharing options...
aslani Posted September 25, 2007 Share Posted September 25, 2007 So what happens when the laptop is docked and has an external keyboard plugged in?lol [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
weaponx Posted September 25, 2007 Share Posted September 25, 2007 (edited) This script will return the "Real" machine type:expandcollapse popup; 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" ) EndifConverted from http://www.microsoft.com/technet/scriptcen...04/hey0921.mspx Edited September 25, 2007 by weaponx Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 25, 2007 Share Posted September 25, 2007 (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 September 25, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now