mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2004
Posts: 27
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Mar 2004
Posts: 27
[Sorry for the cross-post, I think this is the more appropriate group for this question, mods feel free to delete the one in mIRC Help]

Hi All...

Is there any way to set an On LOAD event that will determine the current hostmask? It seems that mIRC can't determine the hostmask without being connected to a server.

Basically, I run mIRC from a flash drive from multiple computers. I would like to automatically determine which computer I am working on at the time, and automatically set the firewall options.

I can do most of the work I think, but the on load question of which computer I'm using is a little tricky.

Thanks,
AltReality

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
If you just want to know which computer you're on (regardless of the exact hostmask) you could use other system metrics, such as $os and $disk(). Other information is available via $com and WMI, though that may be overkill.

If the hostname is important you could use sockets to connect to http://checkip.dyndns.com/ or a similar site.

Joined: Mar 2004
Posts: 27
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Mar 2004
Posts: 27
Thanks for the response!

You are correct that the hostmask itself is not really important, but I can't think of any other truly unique identifying information that can be accessed while mIRC is not connected to a server.

Will sockets work without a connection to an IRC server?

$os is the same on all computers I am using..
not sure how I would use $disk...

I don't know much about $com objects...any thoughts on how that could be used to uniquely identify a computer? (computer name? External IP? hostmask? )

Thanks again

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Could you use the NetInfo alias from this COMllection snippet to get the UserName or ComputerName ?

Code:

alias NetInfo {
  .comopen inf WScript.Network
  var %r = $com(inf,$1,3)
  if (%r) %r = $com(inf).result
  .comclose inf
  return %r
}



//echo -a $netinfo(UserName)
//echo -a $netinfo(ComputerName)

Joined: Mar 2004
Posts: 27
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Mar 2004
Posts: 27
Awesome..that is exactly what I needed.

Thanks for your help!

-AltReality

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You'd use $disk to find total drive space. Typically the total number of bytes from computer to computer won't be the same. This can be true even when both computers both have the same size hard drive. Using COM is still going to be the most accurate method, though it really is a bit of an overkill for what you need. Keep in mind that certain COM events don't work in all versions of Windows, so depending what OS you're using, you may run into problems.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard