mIRC Home    About    Download    Register    News    Help

Print Thread
$os question #204413 19/09/08 08:15 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
$os returning 95, 98, NT, ME, 2K, XP, or NET, any way i can return the full name of the os and the version of it? havent found anything about that in the help file, and i don't want to load a DLL just for it.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $os question [Re: sparta] #204418 19/09/08 11:35 AM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
if $os == 95 { return Microsoft Windows 95 }

and so on?


billythekid
Re: $os question [Re: billythekid] #204420 19/09/08 12:30 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
it dosent return vista, and i want to identify the version of windows installed.. as for mine:

Operating system: WinXP Professional 5.1 Service Pack 2 (Build #2600).


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $os question [Re: sparta] #204423 19/09/08 12:49 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
COM? the moo script doesn't use the dll anymore and does com calls instead I think.
http://www.hm2k.com/projects/moo

Last edited by billythekid; 19/09/08 12:52 PM.

billythekid
Re: $os question [Re: sparta] #204426 19/09/08 01:47 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
//echo -a > $os

> Vista



-genius_at_work

Re: $os question [Re: genius_at_work] #204435 19/09/08 06:00 PM
Joined: Mar 2007
Posts: 218
V
vexed2 Offline
Fjord artisan
Offline
Fjord artisan
V
Joined: Mar 2007
Posts: 218
Same. wink

Re: $os question [Re: sparta] #204437 19/09/08 07:47 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can use WMI to get this information. It should work on most systems with recent versions of Windows (probably not on 9x systems). The following generic $wmi() identifier can be used to easily retrieve the OS version info:
Code:
; $wmi(class,N,property[,timeout])
; class: name of the WMI class to be used
; N: the Nth class instance. N can be 0, to return the total number of instances
; property: the property of interest (ignored if N = 0)
; timeout (optional): number of seconds the COM connection is kept open (default is 120 seconds)
alias wmi {
  if $0 < 2 || ($0 == 2 && $2 != 0) { return }
  if !$com($1) {
    .comopen $1^loc WbemScripting.SWbemLocator
    if ($comerr) return
    .comclose $1^loc $com($1^loc,ConnectServer,3,dispatch* $1^con)
    if ($com($1^con)) .comclose $v1 $com($v1,InstancesOf,3,bstr*,$1,dispatch* $1)
    if (!$com($1)) return
  }
  .timerwmi: $+ $1 -oi 1 $iif($0 > 2 && $($ $+ $0,2) isnum 0-,$v1,120) if ($com( $1)) .comclose $1
  if ($2 == 0) return $comval($1,$2)
  return $comval($1,$2,$3)
}
Then you can try this:

//echo -ag $wmi(Win32_OperatingSystem,1,Caption) $iif($wmi(Win32_OperatingSystem,1,ServicePackMajorVersion),SP $+ $v1)

You can use any of the properties listed here if you need more information (eg BuildNumber).

Edit: small correction

Last edited by qwerty; 20/09/08 12:04 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: $os question [Re: sparta] #204438 19/09/08 08:19 PM
Joined: Dec 2002
Posts: 2,025
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,025

What version of mIRC are you using sparta?

Re: $os question [Re: RoCk] #204445 20/09/08 06:42 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I use 6.21 to 6.34, but qwerty's example worked just fine, and i liked the page he linked to, have some reading to do smile thanx


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }