once I have clicked on a button to set the name and price, the whole script goes dead, I cant even close it (have to right click the task bar and close that way) here is the whole script if you wanted to have a little play with it,
Code: Select all
Gui, 2:Show , w1540 h805, Home
; ############################################################
Gui, 1:Add, Button, x50 y50 w300 h300 gSales ,Sales Mode
Gui, 1:Add, Button, x350 y50 w300 h300 gManager ,Manager Functions
; ############################################################
Gui, 2: Font, s16
Gui, 2:add, Edit, x1100 y10 w400 h100 vClerkNumIn Password* ;or Password#
;~ Gui, 2:Add, Picture, gHome x10 y10 w100 h-1, Home.BMP
Gui, 2:Add, Button, gHome x10 y10 w100 h100, Home
Gui, 2:add, button, gClear x10 y113 w85 h85, C
Gui, 2:Add, Button, gSignOn x95 y113 w170 h85, Sign on
Gui, 2:Add, Button, gAddText x10 y197 w85 h85, 1
Gui, 2:Add, Button, gAddText x95 y197 w85 h85, 2
Gui, 2:Add, Button, gAddText x180 y197 w85 h85, 3
gui, 2:add, button, gAddText x10 y281 w85 h85, 4
Gui, 2:Add, Button, gAddText x95 y281 w85 h85, 5
Gui, 2:Add, Button, gAddText x180 y281 w85 h85, 6
gui, 2:add, button, gAddText x10 y365 w85 h85, 7
Gui, 2:Add, Button, gAddText x95 y365 w85 h85, 8
Gui, 2:Add, Button, gAddText x180 y365 w85 h85, 9
gui, 2:add, button, gAddText x10 y449 w85 h85, 0
Gui, 2:Add, Button, gAddText x95 y449 w85 h85, 00
Gui, 2:Add, Button, gAddText x180 y449 w85 h85, .
Gui, 2:Add, Button, gClockIn x280 y381 w200 h150 ,Clock in
Gui, 2:Add, Button, gClockOut x480 y381 w200 h150 ,Clock out
Gui, 2: Font, s28
Gui, 2:add, text, x660 y10, Please sign on
Gui, 2: Font, s16
; ############################################################
Gui, 3:Add, Button, gHome x10 y10 w100 h100, Home
Gui, 3:Add, Button, x150 y50 w250 h250 gSales ,Sales Mode
Gui, 3:Add, Button, gProgramming x400 y50 w250 h250 ,Programming
Gui, 3:Add, Button, x650 y50 w250 h250 gAddClerk ,Add Clerk
Gui, 3:Add, Button, x900 y50 w250 h250 ,Staff Attend
Gui, 3:Add, Button, x1150 y50 w250 h250 ,Weekly Stock Report
; ############################################################
Gui, 4:Add, Button, gHome x10 y10 w100 h100, Home
gui, 4:add, edit, x150 y10 w400 h50 vClerkName
gui, 4:add, edit, x650 y10 w400 h50 vClerkNum
Gui, 4:Add, Button, gAddTextName x160 y175 w25 h25, A
Gui, 4:Add, Button, gAddTextName x240 y200 w25 h25, B
Gui, 4:Add, Button, gAddTextName x195 y200 w25 h25, C
Gui, 4:Add, Button, gAddTextName x210 y175 w25 h25, D
Gui, 4:Add, Button, gAddTextName x200 y150 w25 h25, E
Gui, 4:Add, Button, gAddTextName x235 y175 w25 h25, F
Gui, 4:Add, Button, gAddTextName x260 y175 w25 h25, G
Gui, 4:Add, Button, gAddTextName x285 y175 w25 h25, H
Gui, 4:Add, Button, gAddTextName x325 y150 w25 h25, I
Gui, 4:Add, Button, gAddTextName x310 y175 w25 h25, J
Gui, 4:Add, Button, gAddTextName x335 y175 w25 h25, K
Gui, 4:Add, Button, gAddTextName x360 y175 w25 h25, L
Gui, 4:Add, Button, gAddTextName x290 y200 w25 h25, M
Gui, 4:Add, Button, gAddTextName x265 y200 w25 h25, N
Gui, 4:Add, Button, gAddTextName x350 y150 w25 h25, O
Gui, 4:Add, Button, gAddTextName x375 y150 w25 h25, P
Gui, 4:Add, Button, gAddTextName x150 y150 w25 h25, Q
Gui, 4:Add, Button, gAddTextName x225 y150 w25 h25, R
Gui, 4:Add, Button, gAddTextName x185 y175 w25 h25, S
Gui, 4:Add, Button, gAddTextName x250 y150 w25 h25, T
Gui, 4:Add, Button, gAddTextName x300 y150 w25 h25, U
Gui, 4:Add, Button, gAddTextName x220 y200 w25 h25, V
Gui, 4:Add, Button, gAddTextName x175 y150 w25 h25, W
Gui, 4:Add, Button, gAddTextName x195 y200 w25 h25, X
Gui, 4:Add, Button, gAddTextName x275 y150 w25 h25, Y
Gui, 4:Add, Button, gAddTextName x170 y200 w25 h25, Z
Gui, 4:Add, Button, gAddTextspace x315 y200 w75 h25, Space
gui, 4:add, button, gClear x10 y113 w85 h85, C
Gui, 4:Add, Button, gAddTextNum x650 y197 w85 h85, 1
Gui, 4:Add, Button, gAddTextNum x734 y197 w85 h85, 2
Gui, 4:Add, Button, gAddTextNum x818 y197 w85 h85, 3
gui, 4:add, button, gAddTextNum x650 y281 w85 h85, 4
Gui, 4:Add, Button, gAddTextNum x734 y281 w85 h85, 5
Gui, 4:Add, Button, gAddTextNum x818 y281 w85 h85, 6
gui, 4:add, button, gAddTextNum x650 y365 w85 h85, 7
Gui, 4:Add, Button, gAddTextNum x734 y365 w85 h85, 8
Gui, 4:Add, Button, gAddTextNum x818 y365 w85 h85, 9
gui, 4:add, button, gAddTextNum x734 y449 w85 h85, 0
gui, 4:add, Button, gAddclerk2 x150 y300 w150 h85, Add Clerk
; ################################################################################
gui, 5:Font, s12
Gui, 5:add, Edit, x1200 y10 w300 h370 vMenu
Gui, 5:add, Edit, x1200 y380 w300 h30 vTotal
Gui, 5:add, text, x660 y10, %ClerkName%
Gui, 5:add, button, gClear x1100 y410 w70 h70, C
Gui, 5:add, button, gAddTextMenu x1100 y480 w70 h70, 7
Gui, 5:add, button, gAddTextMenu x1100 y550 w70 h70, 4
Gui, 5:add, button, gAddTextMenu x1100 y620 w70 h70, 1
Gui, 5:add, button, gAddTextMenu x1100 y690 w70 h70, 0
Gui, 5:add, button, x1170 y410 w70 h70, X
Gui, 5:add, button, gAddTextMenu x1170 y480 w70 h70, 8
Gui, 5:add, button, gAddTextMenu x1170 y550 w70 h70, 5
Gui, 5:add, button, gAddTextMenu x1170 y620 w70 h70, 2
Gui, 5:add, button, gAddTextMenu x1170 y690 w70 h70, 00
Gui, 5:add, button, gSignOff x1240 y410 w70 h70, Sign Off
Gui, 5:add, button, gAddTextMenu x1240 y480 w70 h70, 9
Gui, 5:add, button, gAddTextMenu x1240 y550 w70 h70, 6
Gui, 5:add, button, gAddTextMenu x1240 y620 w70 h70, 3
Gui, 5:add, button, gAddTextMenu x1240 y690 w70 h70, .
Gui, 5:add, button, x1310 y410 w140 h70, Void
Gui, 5:add, button, x1310 y480 w140 h70, Refund
Gui, 5:add, button, x1310 y550 w140 h140, Payment
Gui, 5:add, button, x10 y30 w70 h70, 1
Gui, 5:add, button, x10 y100 w70 h70, 2
Gui, 5:add, button, x10 y170 w70 h70, 3
Gui, 5:add, button, x10 y240 w70 h70, 4
Gui, 5:add, button, x10 y310 w70 h70, 5
Gui, 5:add, button, x10 y380 w70 h70, 6
Gui, 5:add, button, x10 y450 w70 h70, 7
Gui, 5:add, button, x10 y520 w70 h70, 8
Gui, 5:add, button, x10 y590 w70 h70, 9
Gui, 5:add, button, x10 y660 w70 h70, 10
Gui, 5:add, button, x80 y30 w70 h70 ,11
Gui, 5:add, button, x80 y100 w70 h70, 12
Gui, 5:add, button, x80 y170 w70 h70, 13
Gui, 5:add, button, x80 y240 w70 h70, 14
Gui, 5:add, button, x80 y310 w70 h70, 15
Gui, 5:add, button, x80 y380 w70 h70, 16
Gui, 5:add, button, x80 y450 w70 h70, 17
Gui, 5:add, button, x80 y520 w70 h70, 18
Gui, 5:add, button, x80 y590 w70 h70, 19
Gui, 5:add, button, x80 y660 w70 h70, 20
Gui, 5:add, button, x150 y30 w70 h70 ,21
Gui, 5:add, button, x150 y100 w70 h70, 22
Gui, 5:add, button, x150 y170 w70 h70, 23
Gui, 5:add, button, x150 y240 w70 h70, 24
Gui, 5:add, button, x150 y310 w70 h70, 25
Gui, 5:add, button, x150 y380 w70 h70, 26
Gui, 5:add, button, x150 y450 w70 h70, 27
Gui, 5:add, button, x150 y520 w70 h70, 28
Gui, 5:add, button, x150 y590 w70 h70, 29
Gui, 5:add, button, x150 y660 w70 h70, 30
Gui, 5:add, button, x220 y30 w70 h70 ,31
Gui, 5:add, button, x220 y100 w70 h70, 32
Gui, 5:add, button, x220 y170 w70 h70, 33
Gui, 5:add, button, x220 y240 w70 h70, 34
Gui, 5:add, button, x220 y310 w70 h70, 35
Gui, 5:add, button, x220 y380 w70 h70, 36
Gui, 5:add, button, x220 y450 w70 h70, 37
Gui, 5:add, button, x220 y520 w70 h70, 38
Gui, 5:add, button, x220 y590 w70 h70, 39
Gui, 5:add, button, x220 y660 w70 h70, 40
Gui, 5:add, button, x290 y30 w70 h70 ,41
Gui, 5:add, button, x290 y100 w70 h70, 42
Gui, 5:add, button, x290 y170 w70 h70, 43
Gui, 5:add, button, x290 y240 w70 h70, 44
Gui, 5:add, button, x290 y310 w70 h70, 45
Gui, 5:add, button, x290 y380 w70 h70, 46
Gui, 5:add, button, x290 y450 w70 h70, 47
Gui, 5:add, button, x290 y520 w70 h70, 48
Gui, 5:add, button, x290 y590 w70 h70, 49
Gui, 5:add, button, x290 y660 w70 h70, 50
Gui, 5:add, button, x360 y30 w70 h70 ,51
Gui, 5:add, button, x360 y100 w70 h70, 52
Gui, 5:add, button, x360 y170 w70 h70, 53
Gui, 5:add, button, x360 y240 w70 h70, 54
Gui, 5:add, button, x360 y310 w70 h70, 55
Gui, 5:add, button, x360 y380 w70 h70, 56
Gui, 5:add, button, x360 y450 w70 h70, 57
Gui, 5:add, button, x360 y520 w70 h70, 58
Gui, 5:add, button, x360 y590 w70 h70, 59
Gui, 5:add, button, x360 y660 w70 h70, 60
;#######################################################################
#NoEnv
; ------------------------------------------------------------------------------
; Settings
IniFile := "Menu.ini"
BtnCount := 60 ; total number of buttons
BtnsPerColumn := 10 ; buttons per column
BtnW := 100 ; button width
BtnH := 70 ; button height
; ------------------------------------------------------------------------------
Gui, 6:Add, Button, gHome x1460 y10 w70 h70, Home
Y := "ym"
X := "xm"
Loop, %BtnCount% {
IniRead, Menu, %IniFile%, Menu:, %A_Index%, %A_Index%
IniRead, Price, %IniFile%, Price:, %A_Index%, %A_Space%
Gui, 6:Add, Button, %X% %Y% w%BtnW% h%BtnH% vBtn%A_Index% gSet, %Menu%`n%Price%
If (Mod(A_Index, BtnsPerColumn) = 0) {
Y := "ym"
X := "x+0"
}
Else {
Y := "y+0"
X := "xp"
}
}
; ------------------------------------------------------------------------------
Gui, SetBtns:New
Gui, Margin, 10, 10
Gui, Add, Text, h20 0x0200 Section, Enter new name:
Gui, Add, Text, xs hp 0x0200, Enter new price:
W := BtnW - 10
Gui, Add, Edit, ys w%W% h20 Limit vNewName
Gui, Add, Edit, xp y+m wp h20 Limit vNewPrice
GuiControlGet, P, Pos, NewPrice
Gui, Add, Button, xm w80 gWriteIni, Apply
X := PX + PW - 80
Gui, Add, Button, x%X% yp wp gSetBtnsGuiClose, Cancel
; ------------------------------------------------------------------------------
Gui, MenuBtns:Show
Return
; ------------------------------------------------------------------------------
MenuBtnsGuiClose:
ExitApp
; ------------------------------------------------------------------------------
WriteIni:
Gui, Submit, NoHide
; MsgBox, 0, New Values, Name:`t%NewName%`n`nPrice:`t%NewPrice
GuiControl, MenuBtns:, Btn%BtnNumber%, %NewName%`n%NewPrice%
Iniwrite, %NewName%, %IniFile%, Menu:, %BtnNumber%
Iniwrite, %NewPrice%, %IniFile%, Price:, %BtnNumber%
; ------------------------------------------------------------------------------
SetBtnsGuiClose:
Gui, MenuBtns:-Disabled
Gui, Hide
Return
; ------------------------------------------------------------------------------
Set:
BtnNumber := SubStr(A_GuiControl, 4)
GuiControlGet, BtnCaption, , %A_GuiControl%
Split := StrSplit(BtnCaption, "`n", " ")
GuiControl, SetBtns:, NewName, % Split[1]
GuiControl, SetBtns:, NewPrice, % Split[2]
Gui, +Disabled
Gui, SetBtns:Show, , Button %BtnNumber%
Return
;#######################################################################
Gui, 2:Show , w1540 h805, Home
return
Home:
Gui, 2:Hide
Gui, 3:Hide
Gui, 4:Hide
Gui, 6:Hide
Gui, 1:Show , w1540 h805, Home
return
Sales:
Gui, 1:Hide
Gui, 2:Show , w1540 h805, Home
return
Manager:
Gui, 1:Hide
Gui, 3:Show , w1540 h805, Manager Functions
return
SignOn:
gui, 2:Hide
gui, 5:Show , w1540 h805, Order
return
Addclerk:
Gui, 3:Hide
Gui, 4:Show , w1540 h805, Add Clerk
return
SignOff:
Gui, 5:Hide
Gui, 2:Show , w1540 h805, Home
return
Programming:
gui, 3:Hide
Gui, 6:Show , w1540 h805, Programming
Return
;-------------------------------------------------------------
1GuiClose:
Gui, 1:Hide
Gui, 2:Show , w1540 h805, Home
return
2GuiClose:
ExitApp
return
3GuiClose:
Gui, 3:Hide
Gui, 2:Show , w1540 h805, Home
return
4GuiClose:
Gui, 4:Hide
Gui, 3:Show , w1540 h805, Manager Functions
return
Addclerk2:
Gui, Submit, NoHide
IniRead, IsClerkNumExist, Clerk.ini, Clerk, %ClerkNum%
if (IsClerkNumExist == "ERROR")
{
IniRead, ClerkList, Clerk.ini, ClerkList, ClerkList
if (ClerkList == "ERROR")
{
IniWrite, |, Clerk.ini, ClerkList, ClerkList
IniRead, ClerkList, Clerk.ini, ClerkList, ClerkList
}
IfNotInString, ClerkList, %ClerkName%
{
IniWrite, %ClerkName%, Clerk.ini, Clerk, %ClerkNum%
IniWrite, %ClerkList%%ClerkName%|, Clerk.ini, ClerkList, ClerkList
IniWrite, No, Online.ini, Clocked In:, %ClerkName%
MsgBox, 262208,Attention ,%ClerkName% Created.,2
return
}
else
{
MsgBox, 16,Attention ,%ClerkName% In Use.,2
}
}
else
MsgBox, 16,Attention ,%ClerkNum% In Use.,2
return
ClockIn:
Gui, Submit, NoHide
IniRead, IsClerkNumExist, Clerk.ini, Clerk, %ClerkNumIn%
if (IsClerkNumExist == "ERROR")
{
GuiControl,, ClerkNumIn
MsgBox, 262192,Attention ,No Such Clerk.,2
return
}
if (ClerkNumIn == "")
{
GuiControl,, ClerkNumIn
MsgBox, 262192,Attention ,No Such Clerk.,2
return
}
IniRead, ClerkInName, Clerk.ini, Clerk, %ClerkNumIn%
IniRead, Value, Online.ini, Clocked In:, %ClerkInName%
if (Value == "No")
{
FormatTime, TimeIn,, HH:mm:ss
FormatTime, DateIn,, ShortDate
IniWrite, Yes, Online.ini, Clocked In:, %ClerkInName%
IniWrite, %A_Now%, Online.ini, Clocked In:, %ClerkInName% Last Time Clocked in
IniWrite, In, Hours.ini, %ClerkInName% - %DateIn%, %TimeIn% Clocked
GuiControl,, ClerkNumIn
MsgBox, 262208,Attention ,%ClerkInName% Clocked In.,2
return
}
else
GuiControl,, ClerkNumIn
MsgBox, 262192,Attention , Already Clocked In,2
return
ClockOut:
Gui, Submit, NoHide
IniRead, IsClerkNumExist, Clerk.ini, Clerk, %ClerkNumIn%
if (IsClerkNumExist == "ERROR")
{
GuiControl,, ClerkNumIn
MsgBox, 262192,Attention ,No Such Clerk.,2
return
}
if (ClerkNumIn == "")
{
MsgBox, 262192,Attention ,No such Clerk.,2
return
}
IniRead, ClerkInName, Clerk.ini, Clerk, %ClerkNumIn%
IniRead, Value, Online.ini, Clocked In:, %ClerkInName%
if (Value == "Yes")
{
FormatTime, TimeIn,, HH:mm:ss
FormatTime, DateIn,, ShortDate
IniRead, LastTimeClockedin, Online.ini, Clocked In:, %ClerkInName% Last Time Clocked in
RegExMatch(LastTimeClockedin, "(....)(..)(..)(..)(..)(..)",D)
TimeClockedin := ((A_YYYY - D1) ? A_YYYY - D1 " Years, " : "") ((A_MM - D2) ? A_MM - D2 " Months, " : "") ((A_DD - D3) ? A_DD - D3 " Days, " : "") ((A_Hour - D4) ? A_Hour - D4 " Hours, " : "") ((A_Min - D5) ? A_Min - D5 " Minutes, " : "") ((A_Sec - D6) ? A_Sec - D6 " Seconds" : "")
IniWrite, Out (%TimeClockedin%), Hours.ini, %ClerkInName% - %DateIn%, %TimeIn% Clocked
IniWrite, No, Online.ini, Clocked In:, %ClerkInName%
GuiControl,, ClerkNumIn
MsgBox, 262208,Attention ,%ClerkInName% Clocked Out.,2
}
else
MsgBox, 262192,Attention ,Not Clocked In.,2
GuiControl,, ClerkNumIn
return
AddText:
Gui, Submit, NoHide
GuiControl, , ClerkNumIn, % ClerkNumIn A_GuiControl
Return
AddTextMenu:
Gui, Submit, NoHide
GuiControl, , Menu, % Menu A_GuiControl
Return
Clear:
ClerkNumIn := ClerkNum := ClerkName := Menu := ""
GuiControl,, ClerkNumIn
GuiControl,, ClerkNum
GuiControl,, ClerkName
GuiControl,, Menu
return
AddTextName:
Gui, Submit, NoHide
GuiControl,, ClerkName, % ClerkName A_GuiControl
return
AddTextNum:
Gui, Submit, NoHide
GuiControl,, ClerkNum, % ClerkNum A_GuiControl
return
AddTextspace:
GuiControl,, ClerkName, % ClerkName " "
Return
idealy after setting the name and price in the programming section, I would like the names of the buttons to coincide with the buttons on the sign on option, (without showing the price)
once pressed in the sign on option it should add the name and the price to the editbox ( vMenu ) and drop to next line ready for next item to be added also calculating the total of each item as its added in the vTotal edit box