mIRC Home    About    Download    Register    News    Help

Topic Options
#240108 - 26/12/12 11:07 PM $os Windows 8
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48
I have the 'need to get the version of the Windows 8 operating system using the' identifier $ os. Use the mIRC 7.27. Using $ os restores my version of Windows 7. How to solve this problem?


Edited by DEATHJ0KER (26/12/12 11:07 PM)

Top
#240110 - 27/12/12 02:43 AM Re: $os Windows 8 [Re: DEATHJ0KER]
gbz Offline
Babel fish

Registered: 23/02/06
Posts: 74
Windows 8 wasn't out when mIRC 7.27 was released, so mIRC simply doesn't know about it and will display the latest version it does know about, which is 7. I'm very sure the next stable release will fix this.

That said, I've always thought this could be handled better. Replying "7" is simply wrong in this case. IMO mIRC should display "Unknown" or something alike when it doesn't know the OS, rather than returning wrong info. It's not a big deal since these things are updated in later versions, but new mIRC releases don't always come as regularly as they have been lately, so I think this might be worth considering, especially since it's very likely an easy change.

Top
#240123 - 27/12/12 09:48 AM Re: $os Windows 8 [Re: gbz]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
FWIW, in 99.9% of cases, $os is cosmetic. There are pretty much no instances where you need to check $os in a script; it's only really useful in diagnosing bugs in mIRC.

If you're using some script that advertises your system details and you thing it's absolutely necessary to tell them you're running Windows 8, just add "Windows 8" to your script. Or just use a more reliable mechanism, like $COM (see moo script for details on this).

Sidenote: "7" is a heck of a lot more useful than "unknown". That at least narrows it down to "7 or greater" when someone is trying to diagnose a possible mIRC bug or script issue.

While we're on the subject of improving $os though, it's important to note that the way mIRC grabs the OS version is probably the worst way possible. mIRC *should* use a proper API call (the one that moo script does) to get the full OS version name as reported by the OS. AFAIK, mIRC's current mechanism involves MANUALLY translating the build version number into a version name, which is error prone and leads to these "future" problems. Asking Windows for its version name is much better than trying to map it yourself. There's a registry key for this. There is a whole slew of version data in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion -- mIRC should grab one of these and extract the value after "Windows" (if that even matters). Preferably it should just list the entire ProductName string verbatim, but there are probably some backwards compatibility concerns with this.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#240127 - 27/12/12 07:04 PM Re: $os Windows 8 [Re: gbz]
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48
Sure, just wait could be a solution, I could suffice exclusively 's identifier mIRC

Top
#240128 - 27/12/12 07:17 PM Re: $os Windows 8 [Re: argv0]
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48

Yes, of course I could use a com, in my script I'm using darkengine.dll but does not recognize the windows 8.
I tried using this com -> $wmiget(Win32_OperatingSystem).Caption
Code:
 
; jethro ~ http://www.hawkee.com/snippet/6283/#c57267
alias wmiget {
  var %com = cominfo, %com2 = cominfo2, %com3 = cominfo3
  if ($com(%com)) { .comclose %com }
  if ($com(%com2)) { .comclose %com2 }
  if ($com(%com3)) { .comclose %com3 }
  .comopen %com WbemScripting.SWbemLocator
  var %x = $com(%com,ConnectServer,3,dispatch* %com2), $&
    %x = $com(%com2,ExecQuery,3,bstr*,select $prop from $1,dispatch* %com3), $&
    %x = $comval(%com3,$iif($2,$2,1),$prop)
  if ($com(%com)) { .comclose %com }
  if ($com(%com2)) { .comclose %com2 }
  if ($com(%com3)) { .comclose %com3 }
  return %x
  }	

<- but it returns the full name of the operating system. To me it is necessary to obtain the version number, as this function refers to two buttons that appear depending on the version of Windows, this is to preclude the possibility to choose options that are not appropriate to your operating system.
Thank you for this complete answer, try with moo.dll














Top
#240134 - 28/12/12 06:30 AM Re: $os Windows 8 [Re: DEATHJ0KER]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
This will return the whole name of the OS.
Code:
//echo -a -> $wmiget(Win32_OperatingSystem).Caption

This will only return "7"
Code:
//echo -a -> $gettok($wmiget(Win32_OperatingSystem).Caption,3,32)

I dont have windows 8 installed, but my guess would be that the name would be the same but a 8 instead of a 7.

moo.dll is outdated and i dont think it work so well with the latest version of mirc.
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#240136 - 28/12/12 05:35 PM Re: $os Windows 8 [Re: sparta]
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48
$os ---> It 's identifier perfect for my needs.

I wait for the next update to mIRC, I still have much more to do on my script LoL

Top
#240138 - 28/12/12 08:57 PM Re: $os Windows 8 [Re: DEATHJ0KER]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
moo isn't a dll, it's just COM

You can also use COM to grab the registry keys I pointed out above, btw.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#240139 - 28/12/12 09:49 PM Re: $os Windows 8 [Re: argv0]
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48
I tried several dlls and com code, the result is common to all modes of reading is null or shows the build in some cases ...
csdversion does not work.
I think the 'only solution is the one you proposed, but I do not know the syntax well, at least I've never read data via mirc without the' help of dlls ...

How can I read this data into a variable?
var %x $regread { HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion }


Edited by DEATHJ0KER (28/12/12 09:53 PM)

Top
#240140 - 29/12/12 03:35 AM Re: $os Windows 8 [Re: DEATHJ0KER]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
There are COM scripts to read from registry, as I mentioned. The $wmiget script works for me, though.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#240144 - 29/12/12 04:46 PM Re: $os Windows 8 [Re: argv0]
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48
argv0 thanks,
looking... i found something that can help me with the COM, will deepen this unexpected topic

I find no key that refers to the number defined as "7" or "8" 's only key that comes close is StarterEdition, I should define the build manually so ... at least I think

http://www.indigorose.com/webhelp/tu/Program_Reference/Actions/System.GetOSVersionInfo.htm

This is a typical example of aliases wmiget and as seen from the evidence before the 'identifier $wmiget(Win32_OperatingSystem).CSDVersion does not work


Code:
 
;get process info about ram and virtual memory usage
;/getproc <process name>
;don't add .exe next to process name


; $wmiget comes from http://www.mircscripts.org/showdoc.php?type=code&id=3218


alias wmiget {
  var %com = cominfo, %com2 = cominfo2, %com3 = cominfo3
  if ($com(%com)) { .comclose %com }
  if ($com(%com2)) { .comclose %com2 }
  if ($com(%com3)) { .comclose %com3 }
  .comopen %com WbemScripting.SWbemLocator
  var %x = $com(%com,ConnectServer,3,dispatch* %com2), %x = $com(%com2,ExecQuery,3,bstr*,select $prop from $1,dispatch* %com3), %x = $comval(%com3,$iif($2,$2,1),$prop)
  if ($com(%com)) { .comclose %com }
  if ($com(%com2)) { .comclose %com2 }
  if ($com(%com3)) { .comclose %com3 }
  return %x
}


alias getproc { say OS: $chr(91) $+ $wmiget(Win32_OperatingSystem).Caption $+ $chr(93) Running processes: $chr(91) $+ $wmiget(Win32_OperatingSystem).NumberOfProcesses $+ $chr(93) Process Name: $chr(91) $+ $wmiget(win32_process where (description=" $+ $1 $+ .exe")).description $+ $chr(93) PID: $chr(91) $+ $wmiget(win32_process where (description=" $+ $1 $+ .exe")).ProcessId $+ $chr(93) Mem Usage: $chr(91) $+ $bytes($wmiget(win32_process where (description=" $+ $1 $+ .exe")).WorkingSetSize,m).suf $+ $chr(93) VM Size: $chr(91) $+ $bytes($wmiget(win32_process where (description=" $+ $1 $+ .exe")).VirtualSize,m).suf $+ $chr(93) VM Peak: $chr(91) $+ $bytes($wmiget(win32_process where (description=" $+ $1 $+ .exe")).PeakVirtualSize,m).suf $+ $chr(93) }


menu status,channel,nicklist,query {
  -
  Process Info
  .getProc:/getproc $$?=""
  -
}



I think leaving visible ambe two possibilities, the 'option that requires the version of Windows at least for versions 7 and 8, but at the risk of' user activate these functions incorrectly LoL


Edited by DEATHJ0KER (29/12/12 09:04 PM)

Top
#240152 - 29/12/12 11:19 PM Re: $os Windows 8 [Re: DEATHJ0KER]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
You should be using $wmiget(Win32_OperatingSystem).Caption

This returns Windows 7 Ultimate for me, it should return the same for you with "8" instead. Windows 8 has NOT changed this function: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394239(v=vs.85).aspx
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#240153 - 30/12/12 12:41 AM Re: $os Windows 8 [Re: argv0]
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48
Thanks again Argv0, following your advice everything went successfully.

How it works ...
Code:
alias version_x {
  if ($1 = version) {
    if ((7 isin $wmiget(Win32_OperatingSystem).Caption)) { return Windows 7 Ultimate $wmiget(Win32_OperatingSystem).Caption }
    if ((8 isin $wmiget(Win32_OperatingSystem).Caption)) { return Windows 8 Pro $wmiget(Win32_OperatingSystem).Caption }
    else { return  $wmiget(Win32_OperatingSystem).Caption }
  }
}

; Button that will appear in the version of Windows 7

  if ($xdialog(start, 491).isid != $true) && ((7 isin $wmiget(Win32_OperatingSystem).Caption))  {
    ;// Initialising control:Aero7Tuner (Button 491)
 


But even the solution gbz it would not be bad LoL


Edited by DEATHJ0KER (30/12/12 12:53 AM)

Top
#240161 - 30/12/12 04:11 PM Re: $os Windows 8 [Re: sparta]
DEATHJ0KER Offline
Ameglian cow

Registered: 26/04/12
Posts: 48
Thanks Sparta, I solved using an alias ... I chose the long way even if I could actually post resolved simply by $gettok($wmiget(Win32_OperatingSystem).Caption,3,32)

Top