borutc Posted March 2, 2011 Share Posted March 2, 2011 Hello. Okay this might be a stupid question but here it goes. I've got 2 strings, lets say "x" and "1". Can i somehow combine these 2 strings into a variable called $x1? Thank you Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2011 Moderators Share Posted March 2, 2011 borutc,Your variables need to begin with a $ and if they are strings, you use the concatenation operator & to join them:$x = "Hello " $1 = "world!" $x1 = $x & $1 MsgBox(0, "Joined", $x1)All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
borutc Posted March 2, 2011 Author Share Posted March 2, 2011 borutc, Your variables need to begin with a $ and if they are strings, you use the concatenation operator & to join them: $x = "Hello " $1 = "world!" $x1 = $x & $1 MsgBox(0, "Joined", $x1) All clear? M23 Okay maybe i didnt ask right But its like this: lets say we have $something = "x" $somethingelse = "1" i would like to make a variable caled $x1, which is combined with these 2 strings. is it even possible? thank you Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2011 Moderators Share Posted March 2, 2011 borutc, Please explain what you are trying to do. You can create variables using strings like that, but there is nearly always an better way to do things. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
borutc Posted March 2, 2011 Author Share Posted March 2, 2011 borutc,Please explain what you are trying to do.You can create variables using strings like that, but there is nearly always an better way to do things. M23Okay. I have some numbers stored in variables called $x1, $x2, etc. I want to make a loop from 1 to 10. In the loop there is a function that accepts a parameter. So the first time i want it to accept the variable $x1, the 2nd time $x2, etc. So i tought i could combine the number of the loop with "x" to tell it which paramter to accpet. Dont know if this makes any sense Thank you Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2011 Moderators Share Posted March 2, 2011 borutc,It does - and the answer is an array. Store your parameter variables in the array as $aArray[1], $aArray[2], etc and then just use the loop counter to address the one you want on each pass.All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
borutc Posted March 2, 2011 Author Share Posted March 2, 2011 borutc, It does - and the answer is an array. Store your parameter variables in the array as $aArray[1], $aArray[2], etc and then just use the loop counter to address the one you want on each pass. All clear? M23 All clear. Will do that. Thank you Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2011 Moderators Share Posted March 2, 2011 borutc,When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read.And a slightly belated welcome to the AutoIt forum. Glad we could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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