mIRC Home    About    Download    Register    News    Help

Print Thread
#164998 21/11/06 01:29 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Is there a way to use COM to get the CPU information from Windows? I'd like to be able to grab the actual CPU name without needing a DLL. This is mainly for AMDs, where you can't tell based on the CPU speed.


Invision Support
#Invision on irc.irchighway.net
#164999 21/11/06 01:52 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, I found one... but it echoed everything and I only needed the CPU information, so I just put everything into vars because it didn't want to work if I removed them. So... here's what I have... is there a better way?

Code:
alias cpu { 
  .comopen Locator WbemScripting.SWbemLocator 
  if ($comerr) { echo -a Error getting CPU info. | halt } 
  var %com = $com(Locator, ConnectServer, 3, dispatch* Services) 
  var %result = $com(Locator).result 
  var %com(0) = $com(0) 
  if ($com(Services)) { 
    var %com = $com(Services, Get, 3, string, Win32_Processor.DeviceID='CPU0', dispatch* More) 
    var %result = $com(Services).result 
    var %com(0) = $com(0) 
    if ($com(More)) { 
      var %com = $com(More, Name, 3) 
      var %cpu = $com(More).result 
      .comclose More 
    } 
    .comclose Services 
  } 
  .comclose Locator 
  echo -a %cpu
}


Btw, I need it to work for all OS's (or at least 98+).

EDIT:
Here's another I found and modified. It seems to be much faster.

Code:
alias sys.info { 
  if ($1 == Os) { return $read.sys.info(HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName)) $iif($read.sys.info(HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber),Build $v1) $+ $chr(44) $read.sys.info(HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion) } 
  if ($1 == cpu) { return $read.sys.info(HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\ProcessorNameString) } 
} 
alias read.sys.info { 
  var %com = $rand(a,z) $+ $ctime $+ $ticks $+ $ctime $+ $time $+ $rand(1,9999999999) | .comopen %com wscript.Shell 
  if (!$comerr) { var %read_info = $com(%com,RegRead,3,bstr,$1-), %res = $com(%com).result } 
  if (%res) { return $ifmatch } 
  .comclose %com 
} 


If anyone can give me something similar that will work on any OS (or 98+) and is fast, I'd appreciate it. I don't really want to use a piece of someone else's script if someone is willing to make just the part I need because I can't easily give credit when this gets built into Invision.

Thanks.

Last edited by Riamus2; 21/11/06 02:35 AM.

Invision Support
#Invision on irc.irchighway.net
#165000 22/11/06 03:58 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Still looking for thougths. Anyone know enough about COM to help me out? This is one of the areas in mIRC scripting that I haven't worked with, so I don't really know much about it.


Invision Support
#Invision on irc.irchighway.net
#165001 22/11/06 04:03 PM
Joined: Jan 2006
Posts: 40
D
Ameglian cow
Offline
Ameglian cow
D
Joined: Jan 2006
Posts: 40
you may use , moo.dll and darkenginepro

or you wanna try , using other metod?

#165002 22/11/06 09:01 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
No DLLs. I only want to use COM, which is why I asked for a COM solution. smile


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard