mIRC Home    About    Download    Register    News    Help

Print Thread
%windir% #69629 29/01/04 10:17 AM
Joined: Mar 2003
Posts: 58
A
Adler Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Mar 2003
Posts: 58
Can i recieve the %windir%, %userprofile% and so with com objects?
If yes, how

thx

Re: %windir% #69630 29/01/04 10:31 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922

Re: %windir% #69631 29/01/04 12:16 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
alias envar {
  if !$1 { return }
  if $com(a) { .comclose a }
  .comopen a WScript.Shell
  if $comerr { return }
  var %a $com(a,ExpandEnvironmentStrings,3,bstr,$iif($+($chr(37),*,$chr(37)) !iswm $1,$+($chr(37),$1,$chr(37)),$1))
  %a = $iif($left($com(a).result,1) != $chr(37),1,0) 
  return $iif($prop == value,$com(a).result,%a)
  .comclose a
}

//echo -a $envar(blah) - returns 0 because %blah% doesn't exist.
//echo -a $envar(blah).value - returns %blah%
//echo -a $envar(windir) - returns 1 because %windir% exists
//echo -a $envar(windir).value - returns c:\windows (for me)
- i know online already helped but im practicing com objects


New username: hixxy
Re: %windir% #69632 30/01/04 09:25 AM
Joined: Mar 2003
Posts: 58
A
Adler Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Mar 2003
Posts: 58
Thx :-)

Re: %windir% #69633 30/01/04 12:55 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
np smile


New username: hixxy