mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Hello,

I wanna suggest to add the $osbuild,$osbits,$ossp,$osreg identifiers to return some windows extra informations check the examples.

e.g:

//echo -a is: $osbuild
($osbuild will return my windows build version)

is: 7601

//echo -a is: $osbits
($osbits will return my windows bits x32 or x64)

is: 64

//echo -a is: $ossp
($ossp will return my windows service pack if i have not will return $false)

is: sp1

//echo -a is: $osreg
($osreg will return the Windows registration name that i have)

is: DHMHTRHS-PC

NOTE: i know that these identifiers i can get them with an mirc code but also the $os i can get it with a code that does not mean something
just i suggest them to make the mirc be more easy for scripting and for more extra windows informations.

- Thanks!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
System information has been requested in the past. I'm sure it is probably on Khaled's list. One thing that can be a problem there, though...

$os is pretty easy. Every OS (I believe) will respond to the same command to get that. However, other system info items may use different commands depending on the OS. That being said, now that mIRC is only for newer versions of Windows and doesn't support stuff like 95 or 98, the commands are probably standard now. I know that when I set up COM to get this information in the past, I had to use different methods for the older versions of Windows. If you look into the COM objects on MSDN, you'll see that many of the commands require specific versions of Windows to work.

Anyhow, I'm sure it can be done and that it's on his list. And I'm sure the commands are standard now even though they weren't always standard in the past. So that should make it even easier.

Of course, I just use a single identifier for the majority of system information and just supply it with the name of the object to get the information from. So it's not too much code to do most of the things you'd want. You can do the same by taking just about any basic COM script and making the object name and properties $1 and $2 so you can supply them and then have it return the results. $sysinfo(object,property) for example. As long as the results are the same format, you can use that same identifier for everything. Just supply the object and property each time.

Also, there's the whole "where do you stop" question. How many identifiers should we add to mIRC for system info? You listed a few. But there are dozens more that someone will probably want. Should mIRC provide every single identifier? Or should it be left to scripting?

Last edited by Riamus2; 20/03/11 01:02 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
You say to script them with COM but the most of the scripting user including myself have not any idea about it. Also i don't see to be a "problem" in the list. i found them useful and when the author starting adding the $os he can add some of these. And also with the COM code will found problems for other windows versions that does not mean something.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
COM really isn't that hard to learn. Especially if you just take a COM snippet and adjust it to use $1/$2 as mentioned and then supply the COM object name and parameter. The MSDN site has a list of all the COM objects and parameters and what they do and what kind of output to expect.

Also, stating that scripters don't know how to use COM isn't really a good excuse. If a scripter could learn how to script in mIRC, they can learn how to use COM. In fact, it would take considerably less time (you can learn enough to use it in a day without much problem if you make use of a COM snippet that is already written). In fact, I wouldn't be surprised if you can find a snippet already set up with $1 and $2 and all you have to do is use it and provide the information (again, easily available from MSDN). Then you don't need to know anything about COM other than looking up the object and parameter names.

As far as the problems with OS versions, if it's scripted, you can easily adjust it to handle any differences with OS versions. If it's a built-in identifier, it can only do what it was set up to do. You can't just adjust it when something changes from OS to OS. For example, let's say that $os stops working in Windows 8. Until mIRC provides a fix, your script(s) that use it will not function and unless you know how to use COM or another method of getting the OS, you are going to be stuck. If it's scripted instead, then you can make a few changes and have it up and working again very quickly.

Regarding the "how many" question... Think about all of the different system stats someone might want to display. Let's list a few. Graphics card, graphics memory, graphics cpu speed, monitor resolution, monitor frequency. That's just for graphics. Then you have total RAM, RAM in use, CPU, CPU speed, CPU in use, Motherboard, etc. These are just a small number of the things you might want to display (or others will want to display). Should mIRC create identifiers for every single system info item people will want to use? As you can see, it will quickly become a very large number of new identifiers.

I'm not saying some new ones shouldn't be added. But I certainly don't think we need identifiers for everything. And then it becomes a question of where to stop. I can see graphics information or RAM or CPU being much more widely used that OS build, for example.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
$osVersion -> Returns the version: Microsoft Windows XP Professional
$osBuild -> Retuns the build: 5.1.2600
$osSP -> Retuns the sp: SP3
$osReg -> Returns the Regname: Norman
(I couldn't find a reliable way to get the $osBits)

Code:
alias osVersion { return $gettok($OSGET(Name),1,124) }
alias osBuild { return $OSGet(Version) }
alias osSP { return SP $+ $OSGet(ServicePackMajorVersion) }
alias osReg { return $OSGet(RegisteredUser) }


alias -l OSGet {
  var %r
  if ($com(osLoc)) { .comclose osLoc }
  if ($com(osSrv)) { .comclose osSrv }
  if ($com(osOS)) { .comclose osOS }


  .comopen osLoc WbemScripting.SWbemLocator
  if ($comerr) { goto error }
  elseif (!$com(osLoc,ConnectServer,3,dispatch* osSrv)) { goto error }
  elseif (!$com(osSrv,ExecQuery,3,bstr*,select $1 from Win32_OperatingSystem,dispatch* osOS)) { goto error }
  %r = $comval(osOS,1,$1)

  :error
  if ($com(osLoc)) { .comclose osLoc }
  if ($com(osSrv)) { .comclose osSrv }
  if ($com(osOS)) { .comclose osOS }
  return %r
}


I am SReject
My Stuff
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
MSDN

OSArchitecture shows 32/64-bit (for the OS; not for the CPU)
* Not available in XP and older

So, in the script above, //echo -a $osget(OSArchitecture) should give what you want.

Also, I'd recommend using Caption instead of Name for the version. Saves needing to remove data from the result.

And, just a note... Service Pack is not available in Windows NT 4.0 and Windows Me/98/95 using the method in the script above. As mentioned, different versions have different commands to get info (or no commands at all), which can cause issues with build-in identifiers because you can't fix them yourself if they don't work.

Last edited by Riamus2; 20/03/11 09:20 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Good, the $osget is very helpful it will be good if it will be in mIRC in next versions from manually !


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jun 2003
Posts: 81
T
TRT Offline
Babel fish
Offline
Babel fish
T
Joined: Jun 2003
Posts: 81
There is no reason to demand a feature just because you don't understand the scripted variant. (which also has the huge advantage of actually allowing people to see how its implemented compared to a built-in identifier)

Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
I understand the script variant you don't understand that all mirc scripters are not the same and all has not the same knowledge . i know that whatever makes mIRC be more good i suggest it now if someone want to hear me and add my opinion good otherwise i can live without it!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Your comment about the knowledge of scripters isn't really a valid reason to add something. My guess would be that most people who use mIRC wouldn't have a clue how to create a playlist to play music in mIRC even though it's not that challenging. Should mIRC add a playlist just because people don't know how to make one? Or should mIRC let people download a script instead if they can't make their own?

Some of the most basic system stats would be nice to have, but only the most basic (most commonly used). Build isn't used by most people. Service Pack should just be part of $os imo. Username isn't going to be used by many. If any are added, they should be the more commonly used ones. Things like graphics or CPU or RAM for example. Those are things more people are going to make use of. And as I mentioned, we definitely don't want an identifier for every single system stat. And, considering one short script (as above) can do most of the stats without any changes, there isn't much reason to worry about it.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Ok, to make things simpler, I have made this:

Object can be found here*
Property will be under the Object in the above mentioned link
N is the Nth object found. (It's optional)

$WMI(Property,N).Object
Code:
alias WMI {

  if (!$isid || !$1 || !$prop || $2. !isnum || $0 != 2) { return }

  var %r

  if ($com(WMILoc)) { .comclose WMILoc }
  if ($com(WMISrv)) { .comclose WMISrv }
  if ($com(WMIGet)) { .comclose WMIGet }

  .comopen WMILoc WbemScripting.SWbemLocator
  if ($comerr) { goto error }
  elseif (!$com(WMILoc,ConnectServer,3,dispatch* WMISrv)) { goto error }
  elseif (!$com(WMISrv,ExecQuery,3,bstr*,select $1 from $Prop,dispatch* WMIGet)) { goto error }
  %r = $comval(WMIGet,$iif($2,$2,1),$1)

  :error
  if ($com(WMILoc)) { .comclose WMILoc }
  if ($com(WMISrv)) { .comclose WMISrv }
  if ($com(WMIGet)) { .comclose WMIGet }
  return %r
}


* To see a list of properties for an object, find it on the left-hand side of the webpage under "win 32", click it then scroll down until you see the header "Properties" in blue in the right panel of the webpage. This is the data that can be returned with my alias for the specified class.

;Edited for:
; Changed the name of the alias from $statGet to $WMI
; Fixed small bug: "prop" should have been(and is now) $prop
; Added check to make sure the alias was being used as an identifier
;Added note about website

Last edited by FroggieDaFrog; 22/03/11 10:32 PM.

I am SReject
My Stuff
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Yes but if you want to go like your opinion the most of mIRC identifiers shouldn't exist in the program, i know that this is the why the addons exists but i didn't suggest something that is unuseful i suggest something that and the same owner will be used (e.g: for bug reporting) , anyway in one part i agree with you Riammus2 but with something that will help in general part the mirc i am not.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
If you are so dead set on getting system information, instead of requesting small bites of the apple why not just add an identifer like the alias i used to get the system stat info?

That way the user could just get the stats he/she wants instead of bulking up mIRC with a bunch of near useless identifiers?

Last edited by FroggieDaFrog; 22/03/11 10:36 PM.

I am SReject
My Stuff
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
This i have done, since i get this code i am ok.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
lol if Khaled wound up adding many identifiers requested, all the scripted variants wouldn't have been necessary. Perhaps the COM Objects should retire from deployment too. :p

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Did you mean to reply to me? As I said, it isn't necessary and we shouldn't add all kinds of stat identifiers.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Are you always this serious? I was saying that as a joke. Perhaps it was corny to be read as one. :p

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
In response to someone who said they should be added, I can see that as sarcasm (not really a joke). In response to someone who said they shouldn't be added, it just doesn't make any sense. It has nothing to do with being serious, but oh well.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Well, I'm not trying to troll this thread with this matter at hand, but there's a fine line between a joke and sarcasm, and sarcasm wasn't what I had in mind. Pardon me if you saw it as one when I made the post as otherwise a joke, a lame one, that is. I apologize to all who're inclined to being offended and serious-minded.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
As this forum is for Feature suggestions, it is, imo, perfectly sensible for the suggestions made, and other relevant posts, taken seriously.

Page 1 of 2 1 2

Link Copied to Clipboard