Code: Select all
ButtonArray := ["Apples", "Bananas", "Cabbage", "Dolomite", "Eberries", "Flotsam","Mushrooms","Chips","Curry","Damsons","Elderberries","Flan","A","B","C","D","E","F","A","B","C","D","E","Final"]
ButtonNumber := 1
TheNumberOfButton := 1
px := 20
py := 20
Gui, new,,Select a product
Gui, Show, W570 H760 X2000 Y1000,
loop 2
{
loop, 6
{
MyButtonLabel := ButtonArray[ButtonNumber]
posx = x%px%
posy= y%py%
Gui, Add, Button, gMyButtonLabel %posx% %posy% w80 h80, %MyButtonLabel%
ButtonNumber := ButtonNumber + 1
px := px + 90
}
px := 20
py := py+90
}
Gui, Show
return
MyButtonLabel:
Gui, Submit
CoordMode, Mouse, Window
MouseGetPos, MouseX, MouseY
Butty := floor( (MouseX+75) /90) + 6 * floor((MouseY-45) / 90) -4
MsgBox Button Pressed %A_GuiControl% Button %Butty%
ExitApp[Codebox=text file=Untitled.txt][/Codebox]