Sign in to follow this  
Followers 0
Guest Nobody

Variables Inside Variables?

4 posts in this topic

$i = 1

While $i <= $CmdLine[0]

$GK_OptionString = $GK_OptionString & $CmdLine[$i] & "£" ;£ = separator

$i = $i + 1

WEnd

$i = 1

While $i <= $CmdLine[0]

;$GK_OptionString to array

$GA_Options = StringSplit ($GK_OptionString, "£")

F_StripOption("/", "KR", "=", 4)

F_StripOption("/", "VR", "=", 4)

$i = $i + 1

WEnd

;Removes the option itself and keeps the value behind the option DOES NOT FUNKTION!!!

Func F_StripOption($LV_OptPreChar, $LV_OptChar, $LV_OptPostChar, $LV_OptLen)

$LV_Option = $LV_OptPreChar & $LV_OptChar & $LV_OptPostChar

If StringInStr ($GA_Options[$i], $LV_Option) > 0 Then

$LV_Opt = "$GK_Opt" & $LV_OptChar

$LV_Opt = StringTrimLeft ($CmdLine[$i], $LV_OptLen)

MsgBox(0, "Debug $LV_Opt", $LV_Opt) ;Value

MsgBox(0, "Debug $GK_OptKR", $GK_OptKR) ;No value!

EndIf

EndFunc

How to set the value of $LV_Opt and not $LV_Opt itself?

The value of $LV_Opt is: $GK_OptKR

Greatful for advice :D

Share this post


Link to post
Share on other sites



I'm trying to set the value of $LV_Opt.

F_StripOption("/", "KR", "=", 4) ;$LV_OptChar=KR

F_StripOption("/", "VR", "=", 4) ;$LV_OptChar=VR

$LV_Opt = "$GK_Opt" & $LV_OptChar

$LV_Opt = StringTrimLeft ($CmdLine[$i], $LV_OptLen)

First lap $LV_Opt="$GK_Opt" & $LV_OptChar=$GK_OptKR

Next lap $LV_Opt="$GK_Opt" & $LV_OptChar=$GK_OptVR

I'm trying to use my funktion insted of:

If StringInStr ($GA_Options[$i], '/KR=') > 0 Then

$GK_OptKR = StringTrimLeft ($CmdLine[$i], 4)

EndIf

If StringInStr ($GA_Options[$i], '/VR=') > 0 Then

$GK_OptVR = StringTrimLeft ($CmdLine[$i], 4)

EndIf

I'll check the Eval funktion out tomorrow, time is 02:15 in Sweeden and I'm getting sleepy :D

Thanks for trying helping me out!

Share this post


Link to post
Share on other sites

You're setting $i outside of the function, and using it inside the function:

to do this, you would need to define it as Global. See the helpfile for the differences between "Dim", "Local" and "Global".

HTH

:D

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