Sign in to follow this  
Followers 0
dantay9

Quick Question

7 posts in this topic

#1 ·  Posted (edited)

#include <Array.au3>
 
 Dim $GUI[2], $GUI_Pos[2]
 $GUI[1] = GUICreate("Test1", 200, 25, 5, 5)
 
 $GUI_Pos[1] = WinGetPos($GUI[1])
;~ _ArrayDisplay($GUI_Pos[1])

This is just a simple script that will help me understand how to use 2D arrays. How do I get:

$GUI_Pos[1][0] = 5

$GUI_Pos[1][1] = 5

$GUI_Pos[1][2] = 206

$GUI_Pos[1][3] = 55

Kind of like consolidating two arrays into a single array. I guess arrays should have been one of the first things I learned.

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites



Maybe...

#include <Array.au3>

Dim $GUI[2], $GUI_Pos[2][4]
$GUI[1] = GUICreate("Test1", 200, 25, 5, 5)
GUISetState()

$Get_GUI_Pos = WinGetPos($GUI[1])
 _ArrayDisplay($Get_GUI_Pos)

$GUI_Pos[1][0] = $Get_GUI_Pos[0] ; 5
$GUI_Pos[1][1] = $Get_GUI_Pos[1] ; 5
$GUI_Pos[1][2] = $Get_GUI_Pos[2] ; 206
$GUI_Pos[1][3] = $Get_GUI_Pos[3] ; 55

 _ArrayDisplay($GUI_Pos)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Yes, I know that, but I am going to have an unknown number of windows to move. My plan is to use a for loop around the wingetpos() so I can get the position of each window. So...

Dim $GUI[2], $GUI_Pos[2][4]
$GUI[0] = GuiCreate("Test2", 200, 25, 15, 30)
GUISetState()
$GUI[1] = GUICreate("Test1", 200, 25, 5, 5)
GUISetState()

For $x = 0 to Ubound($GUI)
      $GUI_Pos[$x] = WingetPos($GUI[$x])
Next

Syntax -- $GUI_Pos[window number][0-4 from wingetpos()]

$GUI_Pos[1][0] = 5

$GUI_Pos[1][1] = 5

$GUI_Pos[1][2] = 206

$GUI_Pos[1][3] = 55


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Nope, I guess it doesn't work this way. When you store array in an array element you can access it only by assigning it to another temporary variable like:

Dim $avArray[2], $avArr1[2] = [1, 1], $avArr2[2] = [2, 2]
$avArray[0] = $avArr1
$avArray[1] = $avArr2

For $i = 0 To UBound($avArray)-1
    Local $aTmp = $avArray[$i]
    If IsArray($aTmp) Then
        For $j = 0 To UBound($aTmp)-1
            ConsoleWrite($aTmp[$j] & @TAB)
        Next
        ConsoleWrite(@CRLF)
    EndIf
Next
Edited by Authenticity

Share this post


Link to post
Share on other sites

Thanks guys!


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

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