Jump to content
Sign in to follow this  
Dieuz

Help making an array

Recommended Posts

Dieuz

Hi,

I have 255 pictures and I am making a grid with them. The problem is that I did not use an array at first and later on I encountered alot of problem because I did not use an array at the beginning. Can anyone help converting this to an array ($Grid[0]. $Grid[1], $Grid[2], $Grid[3], etc..)?

$Grid_0 = GuiCtrlCreatePic($File, 86, 295, 20, 20)
$Grid_1 = GuiCtrlCreatePic($File, 105, 295, 20, 20)
$Grid_2 = GuiCtrlCreatePic($File, 124, 295, 20, 20)
$Grid_3 = GuiCtrlCreatePic($File, 143, 295, 20, 20)
$Grid_4 = GuiCtrlCreatePic($File, 162, 295, 20, 20)
$Grid_5 = GuiCtrlCreatePic($File, 181, 295, 20, 20)
$Grid_6 = GuiCtrlCreatePic($File, 200, 295, 20, 20)
$Grid_7 = GuiCtrlCreatePic($File, 219, 295, 20, 20)
$Grid_8 = GuiCtrlCreatePic($File, 238, 295, 20, 20)
$Grid_9 = GuiCtrlCreatePic($File, 257, 295, 20, 20)
$Grid_10 = GuiCtrlCreatePic($File, 276, 295, 20, 20)
$Grid_11 = GuiCtrlCreatePic($File, 295, 295, 20, 20)
$Grid_12 = GuiCtrlCreatePic($File, 314, 295, 20, 20)
$Grid_13 = GuiCtrlCreatePic($File, 333, 295, 20, 20)
$Grid_14 = GuiCtrlCreatePic($File, 352, 295, 20, 20)
$Grid_15 = GuiCtrlCreatePic($File,371, 295, 20, 20)
$Grid_16 = GuiCtrlCreatePic($File, 86, 276, 20, 20)
$Grid_17 = GuiCtrlCreatePic($File, 105, 276, 20, 20)
$Grid_18 = GuiCtrlCreatePic($File, 124, 276, 20, 20)
$Grid_19 = GuiCtrlCreatePic($File, 143, 276, 20, 20)
$Grid_20 = GuiCtrlCreatePic($File, 162, 276, 20, 20)
$Grid_21 = GuiCtrlCreatePic($File, 181, 276, 20, 20)
$Grid_22 = GuiCtrlCreatePic($File, 200, 276, 20, 20)
$Grid_23 = GuiCtrlCreatePic($File, 219, 276, 20, 20)
$Grid_24 = GuiCtrlCreatePic($File, 238, 276, 20, 20)
$Grid_25 = GuiCtrlCreatePic($File, 257, 276, 20, 20)
$Grid_26 = GuiCtrlCreatePic($File, 276, 276, 20, 20)
$Grid_27 = GuiCtrlCreatePic($File, 295, 276, 20, 20)
$Grid_28 = GuiCtrlCreatePic($File, 314, 276, 20, 20)
$Grid_29 = GuiCtrlCreatePic($File, 333, 276, 20, 20)
$Grid_30 = GuiCtrlCreatePic($File, 352, 276, 20, 20)
$Grid_31 = GuiCtrlCreatePic($File, 371, 276, 20, 20)

;Until $Grid_255
; It's a 16x16 Grid
Edited by Dieuz

Share this post


Link to post
Share on other sites
jvanegmond

$Grid[0] = GuiCtrlCreatePic($File, 86, 295, 20, 20)
$Grid[1] = GuiCtrlCreatePic($File, 105, 295, 20, 20)
$Grid[2] = GuiCtrlCreatePic($File, 124, 295, 20, 20)
$Grid[3] = GuiCtrlCreatePic($File, 143, 295, 20, 20)
$Grid[4] = GuiCtrlCreatePic($File, 162, 295, 20, 20)
$Grid[5] = GuiCtrlCreatePic($File, 181, 295, 20, 20)
$Grid[6] = GuiCtrlCreatePic($File, 200, 295, 20, 20)
$Grid[7] = GuiCtrlCreatePic($File, 219, 295, 20, 20)
$Grid[8] = GuiCtrlCreatePic($File, 238, 295, 20, 20)
$Grid[9] = GuiCtrlCreatePic($File, 257, 295, 20, 20)
$Grid[10] = GuiCtrlCreatePic($File, 276, 295, 20, 20)
$Grid[11] = GuiCtrlCreatePic($File, 295, 295, 20, 20)
$Grid[12] = GuiCtrlCreatePic($File, 314, 295, 20, 20)
$Grid[13] = GuiCtrlCreatePic($File, 333, 295, 20, 20)
$Grid[14] = GuiCtrlCreatePic($File, 352, 295, 20, 20)
$Grid[15] = GuiCtrlCreatePic($File,371, 295, 20, 20)
$Grid[16] = GuiCtrlCreatePic($File, 86, 276, 20, 20)
$Grid[17] = GuiCtrlCreatePic($File, 105, 276, 20, 20)
$Grid[18] = GuiCtrlCreatePic($File, 124, 276, 20, 20)
$Grid[19] = GuiCtrlCreatePic($File, 143, 276, 20, 20)
$Grid[20] = GuiCtrlCreatePic($File, 162, 276, 20, 20)
$Grid[21] = GuiCtrlCreatePic($File, 181, 276, 20, 20)
$Grid[22] = GuiCtrlCreatePic($File, 200, 276, 20, 20)
$Grid[23] = GuiCtrlCreatePic($File, 219, 276, 20, 20)
$Grid[24] = GuiCtrlCreatePic($File, 238, 276, 20, 20)
$Grid[25] = GuiCtrlCreatePic($File, 257, 276, 20, 20)
$Grid[26] = GuiCtrlCreatePic($File, 276, 276, 20, 20)
$Grid[27] = GuiCtrlCreatePic($File, 295, 276, 20, 20)
$Grid[28] = GuiCtrlCreatePic($File, 314, 276, 20, 20)
$Grid[29] = GuiCtrlCreatePic($File, 333, 276, 20, 20)
$Grid[30] = GuiCtrlCreatePic($File, 352, 276, 20, 20)
$Grid[31] = GuiCtrlCreatePic($File, 371, 276, 20, 20)

Share this post


Link to post
Share on other sites
Dieuz

This doesnt work, I'm getting:

WARNING: $Grid possibly not declared/created yet

$Grid[0] = GuiCtrlCreatePic($File, 86, 295, 20, 20)

I want to create an array because Actually I am using Eval() in my script ( because I dont have an array), and because of that I cannot obfuscate my script.

Edited by Dieuz

Share this post


Link to post
Share on other sites
Danny35d

Dim $Grid[1]
Local $Top = 295
Local $Left = 86

For $x = 0 To 255
    ReDim $Grid[UBound($Grid) + 1]
    $Grid[UBound($Grid) - 1] = GuiCtrlCreatePic($File, $Left , $Top, 20, 20)
    $Left += 19
    If $Left = 390 Then 
        $Top -= 19
        $Left = 86
    EndIf       
Next


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites
Dieuz

Thanks a bunch Danny !

I will try this out!

Share this post


Link to post
Share on other sites
PsaltyDS

This doesnt work, I'm getting:

I want to create an array because Actually I am using Eval() in my script ( because I dont have an array), and because of that I cannot obfuscate my script.

Eval() and Assign() are evil backstabbing turn-coats, that will break your script every chance they get! :)

But, (say it with me) arrays are our friends, arrays are our friends, arrays are... :)

Dim $Grid[256]
$x = 86
$y = 295
$z = 0
For $row = 0 To 15
    For $col = 0 To 15
        $Grid[$z] = GUICtrlCreatePic($File, $x + (20 * $col), $y - (20 * $row), 20, 20)
        $z += 1
    Next
Next

:)

Edit: Oops, forgot to increment $z.

Edited by PsaltyDS

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
Dieuz

...our friends :)

Thx too Psalty!

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  

×