mIRC Homepage
Posted By: Adler %windir% - 29/01/04 10:17 AM
Can i recieve the %windir%, %userprofile% and so with com objects?
If yes, how

thx
Posted By: Online Re: %windir% - 29/01/04 10:31 AM
http://www.mircscripts.org/comments.php?id=1754

$getEnvStr(windir)
Posted By: tidy_trax Re: %windir% - 29/01/04 12:16 PM
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
Posted By: Adler Re: %windir% - 30/01/04 09:25 AM
Thx :-)
Posted By: tidy_trax Re: %windir% - 30/01/04 12:55 PM
np smile
© mIRC Discussion Forums