#76777 - 2003-09-22 02:25 PM
Re: keyexist()
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=004556
basically, compbatt, will exist on laptops and desktops with smart UPSs
pcmcia cards are usually only in laptops, but not all... some PCs have them for smartcard readers.
and some laptops bios may or may not provide the case type... like old inspiron 7000s, but newer ones will.
|
Top
|
|
|
|
#76779 - 2003-09-22 05:35 PM
Re: keyexist()
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Here you go..
code:
BREAK ON CLS ;Requires WMIQuery > http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000117 ;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_systemenclosure.asp ;Thanks Radimus for the inspiration!! $casetype=WMIQuery('ChassisTypes','Win32_SystemEnclosure')[0]
?$casetype
FOR EACH $lt IN split($casetype, '8,9,10,11') $lt="Lap" NEXT
IF $lt<>"" ?'PORTABLE' ELSE ?'DESKTOP' ENDIF
get $k
;Portable units would be ;-- ;8 Portable ;9 Laptop ;10 Notebook ;11 Hand Held
;Desktops would be ;-- ;1 Other ;2 Unknown ;3 Desktop ;4 Low Profile Desktop ;5 Pizza Box ;6 Mini Tower ;7 Tower ;12 Docking Station ;13 All in One ;14 Sub Notebook ;15 Space-Saving ;16 Lunch Box ;17 Main System Chassis ;18 Expansion Chassis ;19 SubChassis ;20 Bus Expansion Chassis ;21 Peripheral Chassis ;22 Storage Chassis ;23 Rack Mount Chassis ;24 Sealed-Case PC
Thanks,
Kent [ 22. September 2003, 17:36: Message edited by: kdyer ]
|
Top
|
|
|
|
#76780 - 2003-09-22 08:31 PM
Re: keyexist()
|
ShaneEP
MM club member
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
Does WMI work on Win9x? If not here is the code I have used in the past. Seems to always work for me.
code:
If KeyExist("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\PNP0C0A") or KeyExist("HKEY_LOCAL_MACHINE\Enum\ACPI\*PNP0C0A") $msg = messagebox ("This is a laptop!!","laptop",0) Else $msg = messagebox ("This is not a laptop!!","laptop",0) Endif
|
Top
|
|
|
|
#76781 - 2003-09-22 11:55 PM
Re: keyexist()
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Work on 9x, natively - no.
You will need to download the following files for 9x/NT.
WMI9X.EXE/WMINT4.EXE
2k/XP/2K3 have WMI built-in.
Kent
|
Top
|
|
|
|
#76782 - 2003-09-23 12:33 AM
Re: keyexist()
|
marck1
Fresh Scripter
Registered: 2000-07-16
Posts: 16
Loc: Rotterdam, The Netherlands
|
Hi,
The following code is used to determine a W2K laptop:
$PCMCIA=READVALUE("HKLM\SYSTEM\CurrentControlSet\Services\Pcmcia","Start") ? "If Value PCMCIA Is 0 Than This Is A Laptop, Else A Desktop, Value Is $PCMCIA"
The following is used for W9x
$PCMCIA=EXISTKEY("HKLM\System\CurrentControlSet\Services\Class\PCMCIA\0000") IF $PCMCIA=0 ? "This Is A Laptop" ENDIF
I hope this is useful.
regards,
Marck
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 259 anonymous users online.
|
|
|