kuhasu Posted April 27, 2008 Share Posted April 27, 2008 (edited) Dim $NextArray[5][2] = [[1, 4, 7, 9, 2],["Why", "not"]] Anyone there can tell me how to clipput this array please? And if it possible, It can Return a delimited string containing all elements within the range specified. I've tried _ArrayToString ,but err.... If there is a 2 demensions array with no value in some elements,is it OK? And is there an easy way to reset the array to 0 or empty? TIA Edited April 28, 2008 by kuhasu Link to comment Share on other sites More sharing options...
monoceres Posted April 27, 2008 Share Posted April 27, 2008 Ok wrote two dimensional array viewer or something: Dim $NextArray[50][25] For $a=0 To UBound($NextArray,1)-1 For $b=0 To UBound($NextArray,2)-1 $NextArray[$a][$b]=Round(Random(0,1000),0) Next Next Dim $string For $i=0 To UBound($NextArray,1)-1 For $j=0 TO UBound($NextArray,2)-1 $string&=$NextArray[$i][$j] If $j<>Ubound($NextArray,2)-1 Then $string&=@TAB&@TAB EndIf Next $string&=@CRLF Next ClipPut($string) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
herewasplato Posted April 27, 2008 Share Posted April 27, 2008 ...And is there an easy way to reset the array to 0 or empty?...You can "Dim" it 1. #include <Array.au3> Dim $avArray[10] $avArray[0] = "JPM" $avArray[1] = "Holger" $avArray[2] = "Jon" $avArray[3] = "Larry" $avArray[4] = "Jeremy" $avArray[5] = "Valik" $avArray[6] = "Cyberslug" $avArray[7] = "Nutster" $avArray[8] = "JdeB" $avArray[9] = "Tylo" _ArrayDisplay( $avArray, "Whole array" ) Dim $avArray[1] _ArrayDisplay( $avArray, "Whole array" )I don' know what to tell you about the ClipPut question - why do you need to do put it into the clipboard? [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 I need to output the array to textpad** Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 Sigh.... Dim $NextArray[50][25] For $a=0 To UBound($NextArray,1)-1 For $b=0 To UBound($NextArray,2)-1 $NextArray[$a][$b]=Round(Random(0,1000),0) Next Next That means I can not $NextArray[5][2]=0 to simply set all the values...... Oh my,85*72..... Link to comment Share on other sites More sharing options...
monoceres Posted April 27, 2008 Share Posted April 27, 2008 Sigh.... Dim $NextArray[50][25] For $a=0 To UBound($NextArray,1)-1 For $b=0 To UBound($NextArray,2)-1 $NextArray[$a][$b]=Round(Random(0,1000),0) Next Next That means I can not $NextArray[5][2]=0 to simply set all the values...... Oh my,85*72.....Looping through an array setting the values won't take long, maybe a couple of milliseconds Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 27, 2008 Share Posted April 27, 2008 Dim $NextArray[5][2] = [[1, 4, 7, 9, 2],["Why", "not"]] You can declare a 2D with preset set values by providing one row of data in each set of brackets. You declared five rows and 2 columns, so there should be up to five sets of brackets with only two values in each (you can partially fill the array and leave the rest null): Dim $NextArray[5][2] = [[0, "Zero"], [1, "Odd"], [2, "Even"], [3, "Why"], [4, "not"]] Calling the first dimension "rows" and the second "columns" is arbitrary, but is also consistent with most common usage. Anyone there can tell me how to clipput this array please?I don't think that can be done, and why would you want to? And if it possible, It can Return a delimited string containing all elements within the range specified. I've tried _ArrayToString ,but err....Post a short demo script of what you tried so we can understand what you want to do. If there is a 2 demensions array with no value in some elements,is it OK?Yes, unused elements do not have to be provided a value and remain null. And is there an easy way to reset the array to 0 or empty?Zero and empty are not necessarily the same thing, but the easiest way to clear the entire array is to just declare it again in the same scope (Global or Local). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 monoceres 's code works ,NICE!Thank you!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,,,,,0,0,0,0,0,0,1,0,0,0,0,0,0,0,,,,,,,0,0,0,0,0,1,1,0,0,0,0,0,0,0,,,,,,,0,0,0,0,1,1,1,0,0,0,0,0,0,0,,,,,,,0,0,0,1,1,0,1,1,0,0,0,0,0,0,,,,,,,0,0,0,1,0,0,0,1,1,0,0,0,0,0,,,,,,,0,0,0,1,0,0,0,0,1,1,0,0,0,0,,,,,,,0,0,0,1,0,0,0,0,0,1,0,0,0,0,,,,,,,0,0,0,1,0,0,0,0,0,1,0,0,0,0,,,,,,,0,0,0,1,0,0,0,0,0,1,0,0,0,0,,,,,,,0,0,0,1,0,0,0,0,0,1,0,0,0,0,,,,,,,0,0,0,1,0,0,0,0,0,1,0,0,0,0,,,,,,,0,0,0,0,1,0,0,0,1,0,0,0,0,0,,,,,,,0,0,0,0,1,1,0,1,1,0,0,0,0,0,,,,,,,0,0,0,0,0,1,1,1,0,0,0,0,0,0,,,,,,,0,0,0,0,0,0,1,0,0,0,0,0,0,0,,,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,And can I let the full things in ONE line?For the reset things,if I redeclare the array,all values are set to null,right?So I think it's no need to pre set the values now:) Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 You can declare a 2D with preset set values by providing one row of data in each set of brackets. You declared five rows and 2 columns, so there should be up to five sets of brackets with only two values in each (you can partially fill the array and leave the rest null): Dim $NextArray[5][2] = [[0, "Zero"], [1, "Odd"], [2, "Even"], [3, "Why"], [4, "not"]] Calling the first dimension "rows" and the second "columns" is arbitrary, but is also consistent with most common usage. I don't think that can be done, and why would you want to? Post a short demo script of what you tried so we can understand what you want to do. Yes, unused elements do not have to be provided a value and remain null. Zero and empty are not necessarily the same thing, but the easiest way to clear the entire array is to just declare it again in the same scope (Global or Local). To PsaltyDS ,Thank you for your kindly reply! I just wanna put the whole array in a line with delimiter into textpad. null value can save the resources of my computer,better!** And to herewasplato,Thank you. Link to comment Share on other sites More sharing options...
herewasplato Posted April 27, 2008 Share Posted April 27, 2008 I just wanna put the whole array in a line with delimiter into textpad. What about writing the array to a file and opening that file using textpad? [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 $string&=@CRLF I got it** u guys NICE! Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 What about writing the array to a file and opening that file using textpad?Can I?How? Link to comment Share on other sites More sharing options...
monoceres Posted April 27, 2008 Share Posted April 27, 2008 Can I?How?Check out FileWrite in helpfile Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 (edited) Check out FileWrite in helpfile OK.I dont wanna trouble u too much,hehe**I often learn and solve problems by myself,~unless there are some conditions I really can not deal with.Cheers!Thanks,guys! Edited April 27, 2008 by kuhasu Link to comment Share on other sites More sharing options...
monoceres Posted April 27, 2008 Share Posted April 27, 2008 OK.I dont wanna trouble u too much,hehe* *I often learn and solve the problem by myself,~unless there are some conditions I really can not deal with.Cheers!Thanks,guys!That's really a good way of seing things I always think of asking someone as the last resort, I think you learn more by experimenting Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
herewasplato Posted April 27, 2008 Share Posted April 27, 2008 ...I often learn and solve problems by myself......just when I had the spoon ready to feed ya...$file = FileOpen("output.txt", 2) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf Dim $NextArray[50][25] For $a = 0 To UBound($NextArray, 1) - 1 For $b = 0 To UBound($NextArray, 2) - 1 $NextArray[$a][$b] = Round(Random(0, 1000), 0) Next Next Dim $string For $i = 0 To UBound($NextArray, 1) - 1 For $j = 0 To UBound($NextArray, 2) - 1 $string &= $NextArray[$i][$j] If $j <> UBound($NextArray, 2) - 1 Then $string &= @TAB & @TAB EndIf Next FileWriteLine($file, $string) Next Run("notepad.exe output.txt") [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
kuhasu Posted April 27, 2008 Author Share Posted April 27, 2008 Thanks man!I just use autoit for 4 days and Am not a computer programming. But now I can do a coup of things by the aid of autoit,so it's amazing!** Link to comment Share on other sites More sharing options...
herewasplato Posted April 27, 2008 Share Posted April 27, 2008 (edited) ...Am not a computer programming...Neither am I :-)You are welcome.Now you see why PsaltyDS and I asked why you wanted the array in the clipboard :-) Edited April 27, 2008 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
kuhasu Posted April 28, 2008 Author Share Posted April 28, 2008 Neither am I :-)You are welcome.Now you see why PsaltyDS and I asked why you wanted the array in the clipboard :-)** 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