EndFunc Posted April 14, 2009 Share Posted April 14, 2009 I can't seem to get it. I want to add the values I get so that when it give the value on the for loop it will add to that the next time around. $String = a,b,c,d,e,f $iString = StringSplit($String, ",") For $i = 1 To $iString[0] Guictrlsetdata($TestField, $iString[$i]) Next Problem is I want it to add to the value each time. So that it will set a new string of a\b\c\d\e\f Can't seem to figure out how to add to the value on each loop. ?? EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
martin Posted April 14, 2009 Share Posted April 14, 2009 I can't seem to get it. I want to add the values I get so that when it give the value on the for loop it will add to that the next time around. $String = a,b,c,d,e,f $iString = StringSplit($String, ",") For $i = 1 To $iString[0] Guictrlsetdata($TestField, $iString[$i]) Next Problem is I want it to add to the value each time. So that it will set a new string of a\b\c\d\e\f Can't seem to figure out how to add to the value on each loop. ?? What do you mean by "add to the value"? If the array element has "a" then does it mean that you want it to become "b", or do you mean you want to add extra elements? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
EndFunc Posted April 14, 2009 Author Share Posted April 14, 2009 (edited) What do you mean by "add to the value"? If the array element has "a" then does it mean that you want it to become "b", or do you mean you want to add extra elements?I want a to become a\band everytime it goes through the loop it adds the next value to the end of the last value with what it finds in the arrar,a becomes, a\b, a\b becomes a\b\c etc?I've been looking at _arraytostring but haven't yet made that work either.Thanks Edited April 14, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
martin Posted April 14, 2009 Share Posted April 14, 2009 I want a to become a\b and everytime it goes through the loop it adds the next value to the end of the last value with what it finds in the arrar, a becomes, a\b, a\b becomes a\b\c etc? I've been looking at _arraytostring but haven't yet made that work either. Thanks I think I get it, but to be sure you start with a string "a,b,c,d,e,f" You make an array $array[0] = 6, [1] = "a", [2] = "b" etc then you want to make a string from this array which will be "a/b/c/d/e/f" Is that what you want? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
EndFunc Posted April 14, 2009 Author Share Posted April 14, 2009 I think I get it, but to be sure you start with a string "a,b,c,d,e,f" You make an array $array[0] = 6, [1] = "a", [2] = "b" etc then you want to make a string from this array which will be "a/b/c/d/e/f" Is that what you want? Yes but I don't alway know the size of the array because I will be using StringSplit with different strings. But want to add them back together with another delimited. So yes. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 15, 2009 Share Posted April 15, 2009 (edited) $String = "a,b,c,d,e,f" $aStrings = SplitString($String, ",") For $i = 1 To $iString[0] GuiCtrlSetData($TestField, GuiCtrlRead($TestField) & "/" & $aStrings[$i]) NextoÝ÷ ØƲmà%µêçjدz²¢ç(ºWZq˦ºVzØ^½©nz)í¡©è¶«²Úâ§våÊǶ¯j[¢wjëh×6$String = "a,b,c,d,e,f" $aStrings = SplitString($String, ",") $sValue = "" For $i = 1 To $iString[0] If $i > 1 Then $sValue &= "/" $sValue &= $aStrings[$i] Next GuiCtrlSetData($TestField, $sValue) HTH Edited April 15, 2009 by WideBoyDixon [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
archgriffin Posted April 15, 2009 Share Posted April 15, 2009 I believe, you are looking for _ArrayAdd, but that will only add the data so if you are using [0] to store the number of elements, then you would probably want to Ubound it, or just add as you go which ever you find easier. But also what WideBoyDixon said would also be wise about using another array. "Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend. 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