dabus Posted January 6, 2005 Posted January 6, 2005 Hi @ All, I've got a little question (maybe I searched for the wrong words ): 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. Any suggestions? Thx in advance.
SlimShady Posted January 6, 2005 Posted January 6, 2005 $Var1 = "Hello " $Var2 = "world" $Var3 = $Var1 & $Var2
MHz Posted January 6, 2005 Posted January 6, 2005 As for what SlimShady has stated except for adding the space.$Var3 = $Var1 & " " & $Var2
dabus Posted January 6, 2005 Author Posted January 6, 2005 (edited) 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. Would be if someone has a hint, since I could use more functions. Edited January 6, 2005 by dabus
Chris_1013 Posted January 6, 2005 Posted January 6, 2005 If you want to combine the contents of $Var1 and $Var2 to make the name of a new variable, then use the Assign function, like this; $Var1 = "Hello" $Var2 = "world" Assign($Var1 & $Var2),"True") MsgBox (0, "" , $Helloworld)
dabus Posted January 6, 2005 Author Posted January 6, 2005 What version do you use? I don't see any asign-function in the help-file.
sykes Posted January 6, 2005 Posted January 6, 2005 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 & $Var2Notice the space behind the Hello We have enough youth. How about a fountain of SMART?
MHz Posted January 6, 2005 Posted January 6, 2005 Yes indeed, I did not see the space. Forgive me. :"> My previous post is incorrect. @sykes Thanks for clarifying.
dabus Posted April 18, 2005 Author Posted April 18, 2005 Hi, I'm working on a Zip-Gui.But I could use a pint of help... Here's my function so far:Func ReadZip ()$Line=0$File=0While 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 EndIfWEndEndFuncIt 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. 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 thisIf StringInStr ( $AddFile1 , $AddFile ) Then ...If StringInStr ( $AddFile2 , $AddFile ) Then ...... you know what I mean?
buzz44 Posted April 18, 2005 Posted April 18, 2005 (edited) 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 April 18, 2005 by Burrup qq
steveR Posted April 18, 2005 Posted April 18, 2005 How about using arrays? $AddFile[1] ... $AddFile[2] AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
dabus Posted April 18, 2005 Author Posted April 18, 2005 (edited) 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 April 18, 2005 by dabus
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