Hicham_777 Posted February 25 Share Posted February 25 var1 = 1 var2 = 2 var3 = var1 + var2 var3 = 1 + 2 var3 = 12 I want the code that combines two variables like this Link to comment Share on other sites More sharing options...
Developers Solution Jos Posted February 25 Developers Solution Share Posted February 25 It this piece of code supposed to be AutoIt3 syntax? Don't think so, just open the helpfile and check the proper syntax. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Hicham_777 Posted February 25 Author Share Posted February 25 After a long search I couldn't find it but I think there is, It's just a matter of time Whoever has the code can show us it Link to comment Share on other sites More sharing options...
Hicham_777 Posted February 25 Author Share Posted February 25 the solution is var3 = var1 & var2 thanks for your suport. SOLVE-SMART 1 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 25 Developers Share Posted February 25 Are you sure? Whatever. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
LAteNightSpecial Posted February 25 Share Posted February 25 (edited) (Edited to reflect the correction below pointed out by Melba23) In AutoIt, if you want to concatenate two variables without performing arithmetic addition, you can simply use the "&" operator. Here's how you can do it: ; Define variables Local $var1 = 1 Local $var2 = 2 ; Concatenate variables Local $var3 = $var1 & $var2 ; Display the concatenated value MsgBox(0, "Concatenated Result", $var3) Here's a simplified version: Local $var1 = 1, $var2 = 2 Local $var3 = $var1 & $var2 MsgBox(0, "Concatenated Result", $var3) Here's the most concise version: Local $var3 = "1" & "2" MsgBox(0, "Concatenated Result", $var3) In the AutoIt help file, the concept of concatenation may not be explicitly listed under a specific section with that term. However, the functionality of concatenation is often explained in various sections that cover string manipulation or operations involving strings. Here's where you can find information related to concatenation in the AutoIt help file: String Handling Functions: The AutoIt help file contains a section dedicated to string handling functions. Functions like StringConcatenate, StringFormat, StringRegExpReplace, and others involve string manipulation, which indirectly covers concatenation. Operators: The help file includes a section on operators where you can find information about the string concatenation operator (&). It explains how the & operator can be used to concatenate strings and concatenate variables with strings. Examples: The help file often includes examples demonstrating various operations, including string concatenation. These examples can be found throughout the documentation, particularly in sections related to string manipulation or variable usage. While the term "concatenation" might not be explicitly listed, the functionality and usage of concatenating strings are covered in the contexts mentioned above within the AutoIt help file. Edited February 25 by LAteNightSpecial Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 25 Moderators Share Posted February 25 LAteNightSpecial, Quote Here's the code in AutoIt that combines two variables: Er, no! If you read the OP, (s)he wants to concatenate the 2 variables - not perform arithmetic addition. The use of the "&" operator is entirely correct in this case. M23 LAteNightSpecial 1 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...
LAteNightSpecial Posted February 25 Share Posted February 25 8 minutes ago, Melba23 said: LAteNightSpecial, Er, no! If you read the OP, (s)he wants to concatenate the 2 variables - not perform arithmetic addition. The use of the "&" operator is entirely correct in this case. M23 You are absolutely correct Melba23! I misread the OP request. I edited my response to reflect the correct logic. Thanks! for pointing that out to me. 🤯 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 25 Moderators Share Posted February 25 Don't forget you're turning it into a string at some of your examples. While most functions will still work backwards it's safer to just cast it if you still need to use it as a number/int (eg.. Number("1" & "2.3") or Int("1" & "2") as an example). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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