mIRC Home    About    Download    Register    News    Help

Print Thread
#26922 29/05/03 05:21 PM
Joined: Apr 2003
Posts: 414
Fjord artisan
OP Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
$Windir Identifier what will return the Windows directory ..
I know that can be do with a script(get dir from msdos.sys) .. Or check in all disk's if the win dir .. But it don't allways corect .. It must do with call the API function "GetWindowsDirectory" ..


mIRC Chm Help 6.16.0.3 Full Anchored!
#26923 29/05/03 05:26 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
You can accomplish this either with a DLL or using COM.

#26924 29/05/03 05:27 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
I would actually prefer $envar()
$envar(windir)
$envar(SystemRoot)
etc.

#26925 29/05/03 08:01 PM
Joined: Dec 2002
Posts: 39
L
Ameglian cow
Offline
Ameglian cow
L
Joined: Dec 2002
Posts: 39
mIRC, as all c/c++ coded apps, can easily retrieve the environment variables that system passes through arge ** (3rd param in main), so, I t would be a nice feature say...
$envvar(1), $envvar(2) returning the name, or $envvar(name) returning true or false
nice suggestion smile

#26926 30/05/03 02:15 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I'm not commenting on your suggestion (people tend to be rather sensitive/argumentative about the whole thing lately :tongue:), but here's how it can be done with the current version of mirc: The WshShell object (part of the Windows Scripting Host) provides a method for expanding environment variables. One of those variables is %WINDIR%, which expands to the actual Windows dir. Here's the alias:
Code:
[color:green]; usage: $com(variable). The %'s around the name are NOT required.[/color]
alias env {
  if * !iswm $1 { return }
  var %a = env $+ $ticks
  .comopen %a Wscript.Shell
  if $comerr { return }
  if $com(%a,ExpandEnvironmentStrings,3,bstr,% $+ $1%) && $com(%a).result != % $+ $1% {
    .comclose %a
    return $ifmatch
  }
  .comclose %a
}
To get the Windows dir, use $env(windir)


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#26927 30/05/03 11:28 AM
Joined: Apr 2003
Posts: 414
Fjord artisan
OP Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
Thank you a lot qwerty smile You are great man smile


mIRC Chm Help 6.16.0.3 Full Anchored!

Link Copied to Clipboard