Sign in to follow this  
Followers 0
ezzetabi

_ReplaceWinSet()

1 post in this topic

Who needs ExpandEnvString?

Func _ReplaceWinSets($INPUT)
   Local $INPUT, $BETWEEN, $C = 2, $N = 2, $C2 = 0
   If StringInStr($INPUT, '%', 0, 2) Then          ;If there are less than 2 % it
      While 1                                      ;is useless to bother.
         $C = $C + 1
         If StringInStr($INPUT, '%', 0, $C) <> 0 Then
            $N = $N + 1                          ;count how many % are present.
         Else
            ExitLoop
         EndIf
      Wend
      $C = 1
      For $C2 = 1 To $N                          ;check the strings between %
         $BETWEEN = StringTrimLeft($INPUT, StringInStr($INPUT, '%', 0, $C))
         $BETWEEN = StringLeft($BETWEEN, StringInStr($BETWEEN, '%', 0, $C) - 1)
         If Not StringInStr($BETWEEN, ' ') And EnvGet($BETWEEN) <> '' Then
            $INPUT = StringReplace($INPUT, '%' & $BETWEEN & '%', EnvGet($BETWEEN))
         Else                                      ;replace OR look in the next one
            $C = $C + 1
         EndIf
      Next
   EndIf

   Return $INPUT                                    ;Return the new string
EndFunc  ;==>_ReplaceWinsets

Share this post


Link to post
Share on other sites



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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0