mIRC Home    About    Download    Register    News    Help

Print Thread
#240108 26/12/12 11:07 PM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
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?

Last edited by DEATHJ0KER; 26/12/12 11:07 PM.

A Creative & Interactive mIRC Scripting
Joined: Feb 2006
Posts: 74
G
gbz Offline
Babel fish
Offline
Babel fish
G
Joined: Feb 2006
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.

gbz #240123 27/12/12 09:48 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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"
gbz #240127 27/12/12 07:04 PM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
Posts: 48
Sure, just wait could be a solution, I could suffice exclusively 's identifier mIRC


A Creative & Interactive mIRC Scripting
argv0 #240128 27/12/12 07:17 PM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
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















A Creative & Interactive mIRC Scripting
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
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,.) }
sparta #240136 28/12/12 05:35 PM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
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


A Creative & Interactive mIRC Scripting
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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"
argv0 #240139 28/12/12 09:49 PM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
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 }

Last edited by DEATHJ0KER; 28/12/12 09:53 PM.

A Creative & Interactive mIRC Scripting
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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"
argv0 #240144 29/12/12 04:46 PM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
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

Last edited by DEATHJ0KER; 29/12/12 09:04 PM.

A Creative & Interactive mIRC Scripting
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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"
argv0 #240153 30/12/12 12:41 AM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
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

Last edited by DEATHJ0KER; 30/12/12 12:53 AM.

A Creative & Interactive mIRC Scripting
sparta #240161 30/12/12 04:11 PM
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
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)


A Creative & Interactive mIRC Scripting

Link Copied to Clipboard