Sign in to follow this  
Followers 0
kuhasu

[Sovled]how to clipput 2 demensions array?

19 posts in this topic

#1 ·  Posted (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 by kuhasu

Share this post


Link to post
Share on other sites



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!

Share this post


Link to post
Share on other sites

...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]

Share this post


Link to post
Share on other sites

I need to output the array to textpad*:D*

Share this post


Link to post
Share on other sites

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.....

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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).

:D


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

Share this post


Link to post
Share on other sites

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:)

Share this post


Link to post
Share on other sites

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).

:D

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!*:D*

And to herewasplato,Thank you.

Share this post


Link to post
Share on other sites

I just wanna put the whole array in a line with delimiter into textpad. :D

What about writing the array to a file and opening that file using textpad?

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

$string&=@CRLF

I got it*:D*

u guys NICE!

Share this post


Link to post
Share on other sites

What about writing the array to a file and opening that file using textpad?

Can I?How?

Share this post


Link to post
Share on other sites

Can I?How?

Check out FileWrite in helpfile :D

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Check out FileWrite in helpfile :D

OK.I dont wanna trouble u too much,hehe*:D*

I often learn and solve problems by myself,~unless there are some conditions I really can not deal with.

Cheers!Thanks,guys!

Edited by kuhasu

Share this post


Link to post
Share on other sites

OK.I dont wanna trouble u too much,hehe* :D *

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 :D

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!

Share this post


Link to post
Share on other sites

...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]

Share this post


Link to post
Share on other sites

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!*:D*

Share this post


Link to post
Share on other sites

#18 ·  Posted (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 by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Neither am I :-)

You are welcome.

Now you see why PsaltyDS and I asked why you wanted the array in the clipboard :-)

*:D*

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0