bcording Posted August 28, 2004 Share Posted August 28, 2004 So lets say you are reading an INI file. You read an item that is "%ComSpec%". The AutoIt option ExpandEnvStrings does not effect this since it's read from a file. I know you could use EnvGet to get the variable. But what about if from the INI you read "%.%temp%.%comspec%.%bob%.%.%". Does anyone have a UDF to expand this? Thanks Link to comment Share on other sites More sharing options...
SlimShady Posted August 28, 2004 Share Posted August 28, 2004 (edited) The first line is an example... MsgBox(0, "", "%COMSPEC% = " & ParseEnvVar("%COMSPEC%")) Func ParseEnvVar($EnvVar) $var = StringMid($EnvVar, 2, StringLen($EnvVar) - 2) Return EnvGet($var) EndFunc Edited August 28, 2004 by SlimShady Link to comment Share on other sites More sharing options...
bcording Posted August 28, 2004 Author Share Posted August 28, 2004 Thanks Slim, but that really dosn't help too much. I figured it out this morning when i sobered up. This function will expand all the environment variables in a string. Func ExpandEnvVars($Cooked) Local $Split, $i, $Expanded $Split = StringSplit($Cooked,"%") For $i = 1 To $Split[0] $Expanded = EnvGet($Split[$i]) If $Expanded <> "" Then $Cooked = StringReplace($Cooked,"%" & $Split[$i] & "%", $Expanded) EndIf Next Return $cooked EndFunc Link to comment Share on other sites More sharing options...
this-is-me Posted August 28, 2004 Share Posted August 28, 2004 I'm pretty sure I don't want to know, but what in the world does your avatar show? An alien? Who else would I be? Link to comment Share on other sites More sharing options...
bcording Posted August 28, 2004 Author Share Posted August 28, 2004 A very close up picture, with flash, of my chihuahua. Link to comment Share on other sites More sharing options...
this-is-me Posted August 28, 2004 Share Posted August 28, 2004 Is the top part a piece of his eye? Who else would I be? Link to comment Share on other sites More sharing options...
bcording Posted August 28, 2004 Author Share Posted August 28, 2004 Left hand bottom corner is her nose. The cool looking alien eye is her eye. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now