Jump to content

Melting variables into another.


dabus
 Share

Recommended Posts

Hi @ All,

I've got a little question (maybe I searched for the wrong words :idiot: ):

I would like to add 2 variables to a new one.

Example:

$Var1 = "Hello "

$Var2 = "world"

$Var3 should be "Hello world"

I have tried $Var3=($Var1&Var2) and other combinations but had no success.

:D

Any suggestions?

Thx in advance.

Link to comment
Share on other sites

Thx.

And how can I do this?

$Var1 = "Hello"

$Var2 = "world"

?????? = "True"

MsgBox (0, "" , $Helloworld )

... should show a window True.

So ??? (which "is" Helloworld") is meant to be a variable made out of variables.

I tried sth. like:

$($Var1&$Var2) = "True"

but it does not work.

Sorry, I can't explain it better. :idiot:

Would be if someone has a hint, since I could use more functions. :D

Edited by dabus
Link to comment
Share on other sites

As for what SlimShady has stated except for adding the space.

$Var3 = $Var1 & " " & $Var2

<{POST_SNAPBACK}>

Slim *did* add a space:

$Var1 = "Hello "

$Var2 = "world"

$Var3 = $Var1 & $Var2

Notice the space behind the Hello

We have enough youth. How about a fountain of SMART?

Link to comment
Share on other sites

  • 3 months later...

Hi, I'm working on a Zip-Gui.

But I could use a pint of help... :D

Here's my function so far:

Func ReadZip ()

$Line=0

$File=0

While 1

$Line=$Line+1

$Search = RegEnumVal ( $Key, $Line)

If $Search = "" Then ExitLoop

$AddFile = RegRead ( $Key , $Search )

If FileExists ( $AddFile ) Then

$Add=1

$File=$File+1

For $n=1 to $File Step 1

Assign( "TmpFile", "$AddFile"&$n, 1)

$SearchFile=$TmpFile

If StringInStr ( $SearchFile , $AddFile ) Then

$Add=0

MsgBox (0, "RunYes:"& $SearchFile , $AddFile )

Else

MsgBox (0, "RunNo:" & $SearchFile , $AddFile )

EndIf

Next

If $Add=1 Then

Assign ( "AddFile"&$n, $AddFile , 2)

MsgBox (0, "Add" , $AddFile )

EndIf

EndIf

WEnd

EndFunc

It searches for some entries in the registry, sees if they are valid and puts them into $AddFile1, $AddFile2 and so on. I also included some MsgBox stuff for debugging.

So far, so good. My problem is the bold part of the text: I want to search them. :D

But $Searchfile is not treated as a var (well, could have worked :) ), but as text. How can I force that? Or is there a better way to do that?

The script should do this

If StringInStr ( $AddFile1 , $AddFile ) Then ...

If StringInStr ( $AddFile2 , $AddFile ) Then ...

... you know what I mean? :huh:

Link to comment
Share on other sites

You could use the latest BETA 3.1.1.7 with one of the new operators...

Operator: &=

Concatenation assignment. e.g. $var = "one", and then $var &= 10 ($var now equals "one10")

Edited by Burrup

qq

Link to comment
Share on other sites

Thx for your advice, I did used a counter and Stringsplit, not Assign.

It looks like this

While 1

...

$Counter=$Counter+1

$Dir=$Dir&"|"&$OutPut

WEnd

$Dir=StringReplace ( $Dir, "|", "", 1 )

$Dir=StringSplit( $Dir, "|")

For $n=1 to $Counter Step 1

MsgBox (0, "Dummy", $Dir[$n] )

Next

So many ways to solve a problem .... :)

Edited by dabus
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...