Hi folks,
I have a major issue with a huge script. I need to have it resized after I have set the GUI controls positions and sizes.
I need to keep every control's aspect ratio. All X, Y, W, H of all controls need to be changed in proportion to the change in GUI dimensions.
It is would take me ages to alter all controls according to A_ScreenWidth, A_ScreenHeight individually. Need a mass solution.
Resize after GUI formed
Re: Resize after GUI formed
Try AutoXYWH() viewtopic.php?f=6&t=1079 - read the thread for various implementations but they should all work
Re: Resize after GUI formed
Already tried. I did one control and the script freezes.ahk7 wrote: ↑01 Oct 2021, 09:55Try AutoXYWH() viewtopic.php?f=6&t=1079 - read the thread for various implementations but they should all work
Re: Resize after GUI formed
You can try my lib GridGUI. It won't allow you to keep the aspect ratio after resizing the GUI, but it does handle resizing for you. It allows you to define the relative position of controls, that is which controls should be above, below or to the sides of other controls. It may be possible to do something that keeps the aspect ratio if the expansion weights are all set to different custom values, but it might not even work then.
Please excuse my spelling I am dyslexic.
Re: Resize after GUI formed
I didn't put much thought into the structure but this shows the basic idea.
You can probably adapt a grid system like @Capn Odin's likely has. where a control occupies nNumber of grid spaces and the size of the grid spaces is based on the size of the gui.
You can probably adapt a grid system like @Capn Odin's likely has. where a control occupies nNumber of grid spaces and the size of the grid spaces is based on the size of the gui.
Code: Select all
#SingleInstance, Force
Main := {}
Main.GuiWidth := 800
Main.GuiHeight := 300
Controls := []
Index := 0
Gui, +AlwaysOnTop +Resize +HwndGuiHwnd
;********************************************************
Controls[ ++Index ] := {} ; 1
Controls[ Index ].TopLeft := { X: 10 , Y: 10 }
Controls[ Index ].BottomRight := { X: Main.GuiWidth / 4 , Y: Main.GuiHeight / 4 }
Gui, Add, Text, % "x" Controls[ Index ].TopLeft.X " y" Controls[ Index ].TopLeft.Y " w" Controls[ Index ].BottomRight.X - Controls[ Index ].TopLeft.X " h" Controls[ Index ].BottomRight.Y - Controls[ Index ].TopLeft.Y " hwndhwnd +Border", Blah, Blah, Blah
Controls[ Index ].Hwnd := hwnd
;********************************************************
Controls[ ++Index ] := {} ; 2
Controls[ Index ].TopLeft := { X: 10 + Main.GuiWidth / 4 , Y: 10 }
Controls[ Index ].BottomRight := { X: ( ( 10 + ( Main.GuiWidth / 4 ) ) + ( Main.GuiWidth / 4 ) ) , Y: Main.GuiHeight / 4 }
Gui, Add, Text, % "x" Controls[ Index ].TopLeft.X " y" Controls[ Index ].TopLeft.Y " w" Controls[ Index ].BottomRight.X - Controls[ Index ].TopLeft.X " h" Controls[ Index ].BottomRight.Y - Controls[ Index ].TopLeft.Y " hwndhwnd +Border", Blah, Blah, Blah
Controls[ Index ].Hwnd := hwnd
;********************************************************
Controls[ ++Index ] := {} ; 3
Controls[ Index ].TopLeft := { X: 10 , Y: 10 + ( Main.GuiHeight / 4 ) }
Controls[ Index ].BottomRight := { X: ( Main.GuiWidth / 2 ) - 20 , Y: Main.GuiHeight / 4 + ( 10 + ( Main.GuiHeight / 4 ) ) }
Gui, Add, Text, % "x" Controls[ Index ].TopLeft.X " y" Controls[ Index ].TopLeft.Y " w" Controls[ Index ].BottomRight.X - Controls[ Index ].TopLeft.X " h" Controls[ Index ].BottomRight.Y - Controls[ Index ].TopLeft.Y " hwndhwnd +Border", Blah, Blah, Blah
Controls[ Index ].Hwnd := hwnd
;********************************************************
Controls[ ++Index ] := {} ; 4
Controls[ Index ].TopLeft := { X: 10 + Main.GuiWidth / 2 - 20 , Y: 10 + ( Main.GuiHeight / 4 ) }
Controls[ Index ].BottomRight := { X: Main.GuiWidth - 20 , Y: Main.GuiHeight / 4 + ( 10 + ( Main.GuiHeight / 4 ) * 2 ) }
Gui, Add, Text, % "x" Controls[ Index ].TopLeft.X " y" Controls[ Index ].TopLeft.Y " w" Controls[ Index ].BottomRight.X - Controls[ Index ].TopLeft.X " h" Controls[ Index ].BottomRight.Y - Controls[ Index ].TopLeft.Y " hwndhwnd +Border", Blah, Blah, Blah
Controls[ Index ].Hwnd := hwnd
;********************************************************
Gui, Show, % "w" Main.GuiWidth " h" Main.GuiHeight
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
ReSizeIt:
WinGetPos,,, w, h, % "ahk_id " GuiHwnd
Main.GuiWidth := w
Main.GuiHeight := h
Controls[ 1 ].TopLeft := { X: 10 , Y: 10 }
Controls[ 1 ].BottomRight := { X: Main.GuiWidth / 4 , Y: Main.GuiHeight / 4 }
Controls[ 2 ].TopLeft := { X: 10 + Main.GuiWidth / 4 , Y: 10 }
Controls[ 2 ].BottomRight := { X: ( ( 10 + ( Main.GuiWidth / 4 ) ) + ( Main.GuiWidth / 4 ) ) , Y: Main.GuiHeight / 4 }
Controls[ 3 ].TopLeft := { X: 10 , Y: 10 + ( Main.GuiHeight / 4 ) }
Controls[ 3 ].BottomRight := { X: ( Main.GuiWidth / 2 ) - 20 , Y: Main.GuiHeight / 4 + ( 10 + ( Main.GuiHeight / 4 ) ) }
Controls[ 4 ].TopLeft := { X: 10 + Main.GuiWidth / 2 - 20 , Y: 10 + ( Main.GuiHeight / 4 ) }
Controls[ 4 ].BottomRight := { X: Main.GuiWidth - 20 , Y: Main.GuiHeight / 4 + ( 10 + ( Main.GuiHeight / 4 ) * 2 ) }
Loop, % Controls.Length()
GuiControl, MoveDraw, % Controls[ A_Index ].Hwnd, % "x" Controls[ A_Index ].TopLeft.X " y" Controls[ A_Index ].TopLeft.Y " w" Controls[ A_Index ].BottomRight.X - Controls[ A_Index ].TopLeft.X " h" Controls[ A_Index ].BottomRight.Y - Controls[ A_Index ].TopLeft.Y
return
GuiSize:
if( GetKeyState( "LButton" ) )
SetTimer, ReSizeIt, -100
return
Re: Resize after GUI formed
Scratch that.
You can just use the difference between the new window size and the original window size. ( New Size / Original Size )
Then that multiplier gets applied to every control.
Code: Select all
#SingleInstance, Force
FirstTime := 1
Gui1 := { Default: { W: "" , H: "" } , W: "" , H: "" , Hwnd: "" , Controls: [] }
Gui, New, +AlwaysOnTop -DPIScale +Resize +HwndHwnd
Gui1.Hwnd := hwnd
Gui, Add, Text, xm ym +Border +Center +0x200 +hwndhwnd, Blah, Blah, Blah
AddControlObject( Gui1.Controls , hwnd )
Index := 1
Loop, 6 {
Gui, Add, Button, xm w200 hwndhwnd, % "Button " ++Index - 1
AddControlObject( Gui1.Controls , hwnd )
Loop, 4 {
Gui, Add, Button, x+10 w200 hwndhwnd, % "Button " ++Index - 1
AddControlObject( Gui1.Controls , hwnd )
}
}
Gui, Add, ListBox, xm w300 r22 hwndhwnd, Item 1|Item 1|Item 1|Item 1|Item 1|Item 1||Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|
AddControlObject( Gui1.Controls , hwnd )
Gui, Show, NA, Demo
WinGetPos,,, w, h, % "ahk_id " Gui1.Hwnd
Gui1.Default.W := Gui1.W := w
Gui1.Default.H := Gui1.H := h
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
AddControlObject( obj , hwnd ){
static Index := 0
obj[ ++Index ] := {}
obj[ Index ].Hwnd := hwnd
GuiControlGet, Pos, Pos, % obj[ Index ].Hwnd
obj[ Index ].X := posX
obj[ Index ].Y := posY
obj[ Index ].W := posW
obj[ Index ].H := posH
}
ReSizeIt:
WinGetPos,,, w, h, % "ahk_id " Gui1.Hwnd
Gui1.W := w , Gui1.H := h
WMulti := ( Gui1.W ) / Gui1.Default.W
HMulti := ( Gui1.H ) / Gui1.Default.H
Loop, % Gui1.Controls.Length() {
x := Gui1.Controls[ A_Index ].X * WMulti
y := Gui1.Controls[ A_Index ].Y * HMulti
w := Gui1.Controls[ A_Index ].W * WMulti
h := Gui1.Controls[ A_Index ].H * HMulti
GuiControl, MoveDraw, % Gui1.Controls[ A_Index ].Hwnd, % "x" x " y" y " w" w " h" h
}
return
GuiSize:
if( FirstTime && !FirstTime := 0 )
return
if( GetKeyState( "LButton" ) )
SetTimer, ReSizeIt, -100
return
Re: Resize after GUI formed
Clever stuff guys. Problem is I would have to change all controls and I have alot. Let me show you my code to get the picture.
I ended up doing the control coordinates in relation to % of the screen to work on different sized monitors/resolutions.
Its not elegant but it does the job. We need something that controls a list of all existing controls! This is useful for bulky existing GUI projects.
Below I have cleaned the code to remove labels and functions (so one can open without errors) so one can test resizing on prefabricated controls.
I ended up doing the control coordinates in relation to % of the screen to work on different sized monitors/resolutions.
Its not elegant but it does the job. We need something that controls a list of all existing controls! This is useful for bulky existing GUI projects.
Code: Select all
WinGetPos,,,,taskh, ahk_class Shell_TrayWnd
ScreenHeight := A_ScreenHeight - taskh - 29, ScreenWidth := A_ScreenWidth - 6, SetPrintersX := 42, SetPrintersY := ScreenHeight - (0.0481 * ScreenHeight), ScreenHeightBorder := ScreenHeight - 4, ScreenWidthBorder := ScreenWidth - 4
GrpBoxPosX := 0.02232 * ScreenWidth, GrpBoxPosY := 0.02286 * ScreenHeight, GrpBoxPosW := 0.95537 * ScreenWidth, GrpBoxPosH := 0.13237 * ScreenHeight
CurrFuncX := 0.02928 * ScreenWidth, CurrFuncY := 0.0589 * ScreenHeight, CurrFuncW := 0.1673 * ScreenWidth, CurrFuncH := 0.07220 * ScreenHeight
CurrUserX := 0.21757 * ScreenWidth, CurrUserY := 0.05897 * ScreenHeight, CurrUserW := 0.16736 * ScreenWidth, CurrUserH := 0.0722 * ScreenHeight
CurrDeptX := 0.40586 * ScreenWidth, CurrDeptY := 0.05897 * ScreenHeight, CurrDeptW := 0.16736 * ScreenWidth, CurrDeptH := 0.0722 * ScreenHeight
ChangeUserX := 0.59414 * ScreenWidth, ChangeUserY := 0.05897 * ScreenHeight, ChangeUserW := 0.16736 * ScreenWidth, ChangeUserH := 0.0722 * ScreenHeight
SIRTPX := 0.02929 * ScreenWidth, SIRTPY := 0.22744 * ScreenHeight, SIRTPW := 0.16736 * ScreenWidth, SIRTPH := 0.15644 * ScreenHeight
OPX := 0.21757 * ScreenWidth, OPY := 0.22744 * ScreenHeight, OPW := 0.16736 * ScreenWidth, OPH := 0.15644 * ScreenHeight
OHOX := 0.40586 * ScreenWidth, OHOY := 0.22744 * ScreenHeight, OHOW := 0.16736 * ScreenWidth, OHOH := 0.15644 * ScreenHeight
OLIVX:= 0.59414 * ScreenWidth, OLIVY:= 0.22744 * ScreenHeight, OLIVW:= 0.16736 * ScreenWidth, OLIVH:= 0.15644 * ScreenHeight
ORX := 0.78243 * ScreenWidth, ORY := 0.22744 * ScreenHeight, ORW := 0.16736 * ScreenWidth, ORH := 0.15644 * ScreenHeight
FuncX := 0.02232 * ScreenWidth, FuncY := 0.19134 * ScreenHeight, FuncW := 0.95537 * ScreenWidth, FuncH := 0.21661 * ScreenHeight
Groups2TierX := 0.02232 * ScreenWidth, Groups2TierY := 0.40794 * ScreenHeight, Groups2TierW := 0.95537 * ScreenWidth, Groups2TierH := 0.24067 * ScreenHeight
Tier2ButtonsX := 0.02929 * ScreenWidth, Tier2ButtonsY := 0.44404 * ScreenHeight, Tier2ButtonsW := 0.16736 * ScreenWidth, Tier2ButtonsH := 0.15644 * ScreenHeight
Tier2ButtonsBX := 0.21757 * ScreenWidth, Tier2ButtonsBY := 0.44404 * ScreenHeight, Tier2ButtonsBW := 0.16736 * ScreenWidth, Tier2ButtonsBH := 0.15644 * ScreenHeight
PrinterSettingsX := 0.5802 * ScreenWidth, PrinterSettingsY := 0.44404 * ScreenHeight
PrinterSettingsBX := 0.45467 * ScreenWidth, PrinterSettingsBY := 0.44404 * ScreenHeight
PrinterSettingsCX := 0.56974 * ScreenWidth, PrinterSettingsCY := 0.44404 * ScreenHeight
ReasonChoiceX := 0.02929 * ScreenWidth, ReasonChoiceY := 0.44404 * ScreenHeight, ReasonChoiceW := 0.16736 * ScreenWidth, ReasonChoiceH := 0.15644 * ScreenHeight
ReorderChoiceX := 0.21757 * ScreenWidth, ReorderChoiceY := 0.44404 * ScreenHeight, ReorderChoiceW := 0.16736 * ScreenWidth, ReorderChoiceH := 0.15644 * ScreenHeight
DropDownAH := 0.15042 * ScreenHeight, DropDownBH := 0.02407 * ScreenHeight
DEPT3X := 0.40586 * ScreenWidth, DEPT3Y := 0.44404 * ScreenHeight, DEPT3W := 0.16736 * ScreenWidth, DEPT3H := 0.15644 * ScreenHeight
DEPT4X := 0.59414 * ScreenWidth, DEPT4Y := 0.44404 * ScreenHeight, DEPT4W := 0.16736 * ScreenWidth, DEPT4H := 0.15644 * ScreenHeight
DEPT5X := 0.78243 * ScreenWidth, DEPT5Y := 0.44404 * ScreenHeight, DEPT5W := 0.16736 * ScreenWidth, DEPT5H := 0.15644 * ScreenHeight
InvScannerX := 0.02232 * ScreenWidth, InvScannerY := 0.66065 * ScreenHeight, InvScannerW := 0.95537 * ScreenWidth, InvScannerH := 0.13237 * ScreenHeight
InvScanEditX := 0.03626 * ScreenWidth, InvScanEditY := 0.68472 * ScreenHeight, InvScanEditW := 0.92748 * ScreenWidth, InvScanEditH := 0.02407 * ScreenHeight
MovInvScanEditX := 0.03626 * ScreenWidth, MovInvScanEditY := 0.68472 * ScreenHeight, MovInvScanEditW := 0.92748 * ScreenWidth, MovInvScanEditH := 0.09627 * ScreenHeight
GroupResultsX := 0.02232 * ScreenWidth, GroupResultsY := 0.80505 * ScreenHeight, GroupResultsW := 0.95537 * ScreenWidth, GroupResultsH := 0.13237 * ScreenHeight
ResDiagX := 0.03626 * ScreenWidth, ResDiagY := 0.82912 * ScreenHeight, ResDiagW := 0.92748 * ScreenWidth, ResDiagH := 0.09627 * ScreenHeight
Gui +LastFound +OwnDialogs +AlwaysOnTop
Gui, Add, GroupBox, x%GrpBoxPosX% y%GrpBoxPosY% w%GrpBoxPosW% h%GrpBoxPosH% , Position
Gui, Add, Text, x%CurrFuncX% y%CurrFuncY% w%CurrFuncW% h%CurrFuncH% 0x1000 Center 0x200 vCurrentFunction hwnd1x1, CURRENT FUNCTION
Gui, Add, Text, x%CurrUserX% y%CurrUserY% w%CurrUserW% h%CurrUserH% 0x1000 Center 0x200 vCurrentUser hwnd3x3, CURRENT USER
Gui, Add, Text, x%CurrDeptX% y%CurrDeptY% w%CurrDeptW% h%CurrDeptH% 0x1000 Center 0x200 vCurrentDept hwnd2x2, CURRENT DEPARTMENT
Gui, Add, Button, x%ChangeUserX% y%ChangeUserY% w%ChangeUserW% h%ChangeUserH% vChangeUser gChangeUser, CHANGE USER
Gui, Add, CheckBox, 0x1000 -Theme x%SIRTPX% y%SIRTPY% w%SIRTPW% h%SIRTPH% vSIRTP gSIRTP, Scan Invoice Ready to Pack
Gui, Add, CheckBox, 0x1000 -Theme x%OPX% y%OPY% w%OPW% h%OPH% vOP gOP, Order Packed
Gui, Add, CheckBox, 0x1000 -Theme x%OHOX% y%OHOY% w%OHOW% h%OHOH% vOHO gOHO, Order Handed Over
Gui, Add, CheckBox, 0x1000 -Theme x%OLIVX% y%OLIVY% w%OLIVW% h%OLIVH% vOLIV gOLIV, Order Loaded in Van
Gui, Add, CheckBox, 0x1000 -Theme x%ORX% y%ORY% w%ORW% h%ORH% vOR gOR, Order Returned
Gui, Add, GroupBox, x%FuncX% y%FuncY% w%FuncW% h%FuncH%, Functions
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupDept, Department
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupOrderPacked, Packing
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupHandedOver, Hand-Over
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupReturned, Returned
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsX% y%Tier2ButtonsY% w%Tier2ButtonsW% h%Tier2ButtonsH% vDept1 gDept1, DEPARTMENT 1
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsX% y%Tier2ButtonsY% w%Tier2ButtonsW% h%Tier2ButtonsH% vPackerReport gPackerReport, PACKER REPORT
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsX% y%Tier2ButtonsY% w%Tier2ButtonsW% h%Tier2ButtonsH% vHandOverReport gHandOverReport, HAND-OVER REPORT
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsBX% y%Tier2ButtonsBY% w%Tier2ButtonsBW% h%Tier2ButtonsBH% vDept2 gDept2, DEPARTMENT 2
Gui, Add, DropDownList, x%Tier2ButtonsBX% y%Tier2ButtonsBY% w%Tier2ButtonsBW% h%Tier2ButtonsBH% hwndhcbx gDepartmentChoice vDepartmentChoice, DEPARTMENT 1|DEPARTMENT 2|DEPARTMENT 3|DEPARTMENT 4|DEPARTMENT 5|ALL DEPARTMENTS
Gui, Add, DropDownList, x%Tier2ButtonsBX% y%Tier2ButtonsBY% w%Tier2ButtonsBW% h%Tier2ButtonsBH% hwndhcby gRouteChoice vRouteChoice, ROUTE 1|ROUTE 2|ROUTE 3|ROUTE 4|ROUTE 5|ALL ROUTES
IniRead, PrintLabelsONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PrintLabelsONOFF
Gui, Add, Checkbox, x%PrinterSettingsX% y%PrinterSettingsY% vPrintLabelsONOFF gPrintLabelsONOFF Checked%PrintLabelsONOFF%, Labels to Printer
IniRead, LabelsChromeONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, LabelsChromeONOFF
Gui, Add, Checkbox, x%PrinterSettingsX% y%PrinterSettingsY% vLabelsChromeONOFF gLabelsChromeONOFF Checked%LabelsChromeONOFF%, Labels to Chrome
IniRead, PrintPackerReportONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PrintPackerReportONOFF
Gui, Add, Checkbox, x%PrinterSettingsBX% y%PrinterSettingsBY% vPrintPackerReportONOFF gPrintPackerReportONOFF Checked%PrintPackerReportONOFF%, Packer Report to Printer
IniRead, PackerReportChromeONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PackerReportChromeONOFF
Gui, Add, Checkbox, x%PrinterSettingsBX% y%PrinterSettingsBY% vPackerReportChromeONOFF gPackerReportChromeONOFF Checked%PackerReportChromeONOFF%, Packer Report to Chrome
IniRead, PrintHandOverReportONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PrintHandOverReportONOFF
Gui, Add, Checkbox, x%PrinterSettingsCX% y%PrinterSettingsCY% vPrintHandOverReportONOFF gPrintHandOverReportONOFF Checked%PrintHandOverReportONOFF%, Hand Over Report to Printer
IniRead, HandOverReportChromeONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, HandOverReportChromeONOFF
Gui, Add, Checkbox, x%PrinterSettingsCX% y%PrinterSettingsCY% vHandOverReportChromeONOFF gHandOverReportChromeONOFF Checked%HandOverReportChromeONOFF%, Hand Over Report to Chrome
Gui, Add, DropDownList, x%ReasonChoiceX% y%ReasonChoiceY% w%ReasonChoiceW% h%ReasonChoiceH% r6 hwndhcba gReasonChoice vReasonChoice, INCORRECT ITEMS|DAMAGED|INCORRECT INVOICE|SHORT DATED|OTHER
Gui, Add, DropDownList, xx%ReorderChoiceX% y%ReorderChoiceY% w%ReorderChoiceW% h%ReorderChoiceH% r6 hwndhcbb gReorderChoice vReorderChoice, REORDER|CANCEL
GuiControl, Choose, ReasonChoice, 1
GuiControl, Choose, ReorderChoice, 1
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcbx% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcbx%
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcby% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcby%
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcba% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcba%
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcbb% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcbb%
GuiControl, Choose, DepartmentChoice, 6
GuiControl, Choose, RouteChoice, 6
Gui, Add, CheckBox, 0x1000 -Theme x%DEPT3X% y%DEPT3Y% w%DEPT3W% h%DEPT3H% vDept3 gDept3, DEPARTMENT 3
Gui, Add, CheckBox, 0x1000 -Theme x%DEPT4X% y%DEPT4Y% w%DEPT4W% h%DEPT4H% vDept4 gDept4, DEPARTMENT 4
Gui, Add, CheckBox, 0x1000 -Theme x%DEPT5X% y%DEPT5Y% w%DEPT5W% h%DEPT5H% vDept5 gDept5, DEPARTMENT 5
Gui, Add, GroupBox, x%InvScannerX% y%InvScannerY% w%InvScannerW% h%InvScannerH%, Invoice Scanner
Gui, Add, Edit, x%InvScanEditX% y%InvScanEditY% w%InvScanEditW% h%InvScanEditH% -E0x200 vInvoiceScanEdit hwndHED1
Gui, Add, Button, Hidden Default gInvoiceQRCapture, OK
SetEditCueBanner(HED1, "Scan Invoice Here Ex. SIMS_001_IN_000999_ABCDEF_000010.00_0_0_R1")
GuiControl, Move, InvoiceScanEdit, x%MovInvScanEditX% y%MovInvScanEditY% w%MovInvScanEditW% h%MovInvScanEditH%
GuiControl, +Center 0x200 -VScroll -HScroll, InvoiceScanEdit
Gui, Add, GroupBox, x%GroupResultsX% y%GroupResultsY% w%GroupResultsW% h%GroupResultsH%, Results
Gui, Add, Text, x%ResDiagX% y%ResDiagY% w%ResDiagW% h%ResDiagH% 0x1000 vResultDialog, Stand-by for result.
Gui, Font, cBlue
Gui, Add, Text, x%SetPrintersX% y%SetPrintersY% gSetPrinters, Set Printers
Gui, Font,
GuiControl, Hide, GroupOrderPacked
GuiControl, Hide, PackerReport
GuiControl, Hide, GroupHandedOver
GuiControl, Hide, HandOverReport
GuiControl, Hide, RouteChoice
GuiControl, Hide, DepartmentChoice
;GuiControl, Hide, Dept5
GuiControl, Hide, GroupReturned
GuiControl, Hide, ReasonChoice
GuiControl, Hide, ReorderChoice
GuiControl, Hide, PrintLabelsONOFF
GuiControl, Hide, LabelsChromeONOFF
GuiControl, Hide, PrintPackerReportONOFF
GuiControl, Hide, PackerReportChromeONOFF
GuiControl, Hide, PrintHandOverReportONOFF
GuiControl, Hide, HandOverReportChromeONOFF
GuiControl, Hide, CurrentUser
GuiControl, Hide, ChangeUser
Gui, Add, Picture, % "x" 0 " y" 0 " w" ScreenWidth " h" 4 " +0x4E +HWNDhPicture1"
CreatePixel("000000", hPicture1)
Gui, Add, Picture, % "x" 0 " y" ScreenHeightBorder " w" ScreenWidth " h" 4 " +0x4E +HWNDhPicture2"
CreatePixel("000000", hPicture2)
Gui, Add, Picture, % "x" 0 " y" 0 " w" 4 " h" ScreenHeight " +0x4E +HWNDhPicture3"
CreatePixel("000000", hPicture3)
Gui, Add, Picture, % "x" ScreenWidthBorder " y" 0 " w" 4 " h" ScreenHeight " +0x4E +HWNDhPicture4"
CreatePixel("000000", hPicture4)
Gui, Show, x0 y0 h%ScreenHeight% w%ScreenWidth%, Pack Tracking
SetStaticColor(1x1, 0xFF0000)
SetStaticColor(2x2, 0xFF0000)
SetStaticColor(3x3, 0xFF0000)
Initialize()
IniRead, LabelPrinter, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, LabelPrinter
{
If LabelPrinter = ERROR
GoTo, SetPrinters
}
IniRead, ReportPrinter, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, ReportPrinter
{
If ReportPrinter = ERROR
GoTo, SetPrinters
}
Return
Code: Select all
WinGetPos,,,,taskh, ahk_class Shell_TrayWnd
ScreenHeight := A_ScreenHeight - taskh - 29, ScreenWidth := A_ScreenWidth - 6, SetPrintersX := 42, SetPrintersY := ScreenHeight - (0.0481 * ScreenHeight), ScreenHeightBorder := ScreenHeight - 4, ScreenWidthBorder := ScreenWidth - 4
GrpBoxPosX := 0.02232 * ScreenWidth, GrpBoxPosY := 0.02286 * ScreenHeight, GrpBoxPosW := 0.95537 * ScreenWidth, GrpBoxPosH := 0.13237 * ScreenHeight
CurrFuncX := 0.02928 * ScreenWidth, CurrFuncY := 0.0589 * ScreenHeight, CurrFuncW := 0.1673 * ScreenWidth, CurrFuncH := 0.07220 * ScreenHeight
CurrUserX := 0.21757 * ScreenWidth, CurrUserY := 0.05897 * ScreenHeight, CurrUserW := 0.16736 * ScreenWidth, CurrUserH := 0.0722 * ScreenHeight
CurrDeptX := 0.40586 * ScreenWidth, CurrDeptY := 0.05897 * ScreenHeight, CurrDeptW := 0.16736 * ScreenWidth, CurrDeptH := 0.0722 * ScreenHeight
ChangeUserX := 0.59414 * ScreenWidth, ChangeUserY := 0.05897 * ScreenHeight, ChangeUserW := 0.16736 * ScreenWidth, ChangeUserH := 0.0722 * ScreenHeight
SIRTPX := 0.02929 * ScreenWidth, SIRTPY := 0.22744 * ScreenHeight, SIRTPW := 0.16736 * ScreenWidth, SIRTPH := 0.15644 * ScreenHeight
OPX := 0.21757 * ScreenWidth, OPY := 0.22744 * ScreenHeight, OPW := 0.16736 * ScreenWidth, OPH := 0.15644 * ScreenHeight
OHOX := 0.40586 * ScreenWidth, OHOY := 0.22744 * ScreenHeight, OHOW := 0.16736 * ScreenWidth, OHOH := 0.15644 * ScreenHeight
OLIVX:= 0.59414 * ScreenWidth, OLIVY:= 0.22744 * ScreenHeight, OLIVW:= 0.16736 * ScreenWidth, OLIVH:= 0.15644 * ScreenHeight
ORX := 0.78243 * ScreenWidth, ORY := 0.22744 * ScreenHeight, ORW := 0.16736 * ScreenWidth, ORH := 0.15644 * ScreenHeight
FuncX := 0.02232 * ScreenWidth, FuncY := 0.19134 * ScreenHeight, FuncW := 0.95537 * ScreenWidth, FuncH := 0.21661 * ScreenHeight
Groups2TierX := 0.02232 * ScreenWidth, Groups2TierY := 0.40794 * ScreenHeight, Groups2TierW := 0.95537 * ScreenWidth, Groups2TierH := 0.24067 * ScreenHeight
Tier2ButtonsX := 0.02929 * ScreenWidth, Tier2ButtonsY := 0.44404 * ScreenHeight, Tier2ButtonsW := 0.16736 * ScreenWidth, Tier2ButtonsH := 0.15644 * ScreenHeight
Tier2ButtonsBX := 0.21757 * ScreenWidth, Tier2ButtonsBY := 0.44404 * ScreenHeight, Tier2ButtonsBW := 0.16736 * ScreenWidth, Tier2ButtonsBH := 0.15644 * ScreenHeight
PrinterSettingsX := 0.5802 * ScreenWidth, PrinterSettingsY := 0.44404 * ScreenHeight
PrinterSettingsBX := 0.45467 * ScreenWidth, PrinterSettingsBY := 0.44404 * ScreenHeight
PrinterSettingsCX := 0.56974 * ScreenWidth, PrinterSettingsCY := 0.44404 * ScreenHeight
ReasonChoiceX := 0.02929 * ScreenWidth, ReasonChoiceY := 0.44404 * ScreenHeight, ReasonChoiceW := 0.16736 * ScreenWidth, ReasonChoiceH := 0.15644 * ScreenHeight
ReorderChoiceX := 0.21757 * ScreenWidth, ReorderChoiceY := 0.44404 * ScreenHeight, ReorderChoiceW := 0.16736 * ScreenWidth, ReorderChoiceH := 0.15644 * ScreenHeight
DropDownAH := 0.15042 * ScreenHeight, DropDownBH := 0.02407 * ScreenHeight
DEPT3X := 0.40586 * ScreenWidth, DEPT3Y := 0.44404 * ScreenHeight, DEPT3W := 0.16736 * ScreenWidth, DEPT3H := 0.15644 * ScreenHeight
DEPT4X := 0.59414 * ScreenWidth, DEPT4Y := 0.44404 * ScreenHeight, DEPT4W := 0.16736 * ScreenWidth, DEPT4H := 0.15644 * ScreenHeight
DEPT5X := 0.78243 * ScreenWidth, DEPT5Y := 0.44404 * ScreenHeight, DEPT5W := 0.16736 * ScreenWidth, DEPT5H := 0.15644 * ScreenHeight
InvScannerX := 0.02232 * ScreenWidth, InvScannerY := 0.66065 * ScreenHeight, InvScannerW := 0.95537 * ScreenWidth, InvScannerH := 0.13237 * ScreenHeight
InvScanEditX := 0.03626 * ScreenWidth, InvScanEditY := 0.68472 * ScreenHeight, InvScanEditW := 0.92748 * ScreenWidth, InvScanEditH := 0.02407 * ScreenHeight
MovInvScanEditX := 0.03626 * ScreenWidth, MovInvScanEditY := 0.68472 * ScreenHeight, MovInvScanEditW := 0.92748 * ScreenWidth, MovInvScanEditH := 0.09627 * ScreenHeight
GroupResultsX := 0.02232 * ScreenWidth, GroupResultsY := 0.80505 * ScreenHeight, GroupResultsW := 0.95537 * ScreenWidth, GroupResultsH := 0.13237 * ScreenHeight
ResDiagX := 0.03626 * ScreenWidth, ResDiagY := 0.82912 * ScreenHeight, ResDiagW := 0.92748 * ScreenWidth, ResDiagH := 0.09627 * ScreenHeight
Gui +LastFound +OwnDialogs +AlwaysOnTop
Gui, Add, GroupBox, x%GrpBoxPosX% y%GrpBoxPosY% w%GrpBoxPosW% h%GrpBoxPosH% , Position
Gui, Add, Text, x%CurrFuncX% y%CurrFuncY% w%CurrFuncW% h%CurrFuncH% 0x1000 Center 0x200 vCurrentFunction hwnd1x1, CURRENT FUNCTION
Gui, Add, Text, x%CurrUserX% y%CurrUserY% w%CurrUserW% h%CurrUserH% 0x1000 Center 0x200 vCurrentUser hwnd3x3, CURRENT USER
Gui, Add, Text, x%CurrDeptX% y%CurrDeptY% w%CurrDeptW% h%CurrDeptH% 0x1000 Center 0x200 vCurrentDept hwnd2x2, CURRENT DEPARTMENT
Gui, Add, Button, x%ChangeUserX% y%ChangeUserY% w%ChangeUserW% h%ChangeUserH% vChangeUser, CHANGE USER
Gui, Add, CheckBox, 0x1000 -Theme x%SIRTPX% y%SIRTPY% w%SIRTPW% h%SIRTPH% vSIRTP, Scan Invoice Ready to Pack
Gui, Add, CheckBox, 0x1000 -Theme x%OPX% y%OPY% w%OPW% h%OPH% vOP, Order Packed
Gui, Add, CheckBox, 0x1000 -Theme x%OHOX% y%OHOY% w%OHOW% h%OHOH% vOHO, Order Handed Over
Gui, Add, CheckBox, 0x1000 -Theme x%OLIVX% y%OLIVY% w%OLIVW% h%OLIVH% vOLIV, Order Loaded in Van
Gui, Add, CheckBox, 0x1000 -Theme x%ORX% y%ORY% w%ORW% h%ORH% vOR, Order Returned
Gui, Add, GroupBox, x%FuncX% y%FuncY% w%FuncW% h%FuncH%, Functions
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupDept, Department
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupOrderPacked, Packing
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupHandedOver, Hand-Over
Gui, Add, GroupBox, x%Groups2TierX% y%Groups2TierY% w%Groups2TierW% h%Groups2TierH% vGroupReturned, Returned
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsX% y%Tier2ButtonsY% w%Tier2ButtonsW% h%Tier2ButtonsH% vDept1, DEPARTMENT 1
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsX% y%Tier2ButtonsY% w%Tier2ButtonsW% h%Tier2ButtonsH% vPackerReport, PACKER REPORT
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsX% y%Tier2ButtonsY% w%Tier2ButtonsW% h%Tier2ButtonsH% vHandOverReport, HAND-OVER REPORT
Gui, Add, CheckBox, 0x1000 -Theme x%Tier2ButtonsBX% y%Tier2ButtonsBY% w%Tier2ButtonsBW% h%Tier2ButtonsBH% vDept2, DEPARTMENT 2
Gui, Add, DropDownList, x%Tier2ButtonsBX% y%Tier2ButtonsBY% w%Tier2ButtonsBW% h%Tier2ButtonsBH% hwndhcbx x42 vDepartmentChoice, DEPARTMENT 1|DEPARTMENT 2|DEPARTMENT 3|DEPARTMENT 4|DEPARTMENT 5|ALL DEPARTMENTS
Gui, Add, DropDownList, x%Tier2ButtonsBX% y%Tier2ButtonsBY% w%Tier2ButtonsBW% h%Tier2ButtonsBH% hwndhcby x42 vRouteChoice, ROUTE 1|ROUTE 2|ROUTE 3|ROUTE 4|ROUTE 5|ALL ROUTES
IniRead, PrintLabelsONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PrintLabelsONOFF
Gui, Add, Checkbox, x%PrinterSettingsX% y%PrinterSettingsY% vPrintLabelsONOFF x42 Checked%PrintLabelsONOFF%, Labels to Printer
IniRead, LabelsChromeONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, LabelsChromeONOFF
Gui, Add, Checkbox, x%PrinterSettingsX% y%PrinterSettingsY% vLabelsChromeONOFF x42 Checked%LabelsChromeONOFF%, Labels to Chrome
IniRead, PrintPackerReportONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PrintPackerReportONOFF
Gui, Add, Checkbox, x%PrinterSettingsBX% y%PrinterSettingsBY% vPrintPackerReportONOFF x42 Checked%PrintPackerReportONOFF%, Packer Report to Printer
IniRead, PackerReportChromeONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PackerReportChromeONOFF
Gui, Add, Checkbox, x%PrinterSettingsBX% y%PrinterSettingsBY% vPackerReportChromeONOFF x42 Checked%PackerReportChromeONOFF%, Packer Report to Chrome
IniRead, PrintHandOverReportONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, PrintHandOverReportONOFF
Gui, Add, Checkbox, x%PrinterSettingsCX% y%PrinterSettingsCY% vPrintHandOverReportONOFF x42 Checked%PrintHandOverReportONOFF%, Hand Over Report to Printer
IniRead, HandOverReportChromeONOFF, C:\AHK\PackLabelPrinter\PrinterSettings.ini, PrinterSettings, HandOverReportChromeONOFF
Gui, Add, Checkbox, x%PrinterSettingsCX% y%PrinterSettingsCY% vHandOverReportChromeONOFF x42 Checked%HandOverReportChromeONOFF%, Hand Over Report to Chrome
Gui, Add, DropDownList, x%ReasonChoiceX% y%ReasonChoiceY% w%ReasonChoiceW% h%ReasonChoiceH% r6 hwndhcba x42 vReasonChoice, INCORRECT ITEMS|DAMAGED|INCORRECT INVOICE|SHORT DATED|OTHER
Gui, Add, DropDownList, xx%ReorderChoiceX% y%ReorderChoiceY% w%ReorderChoiceW% h%ReorderChoiceH% r6 hwndhcbb x42 vReorderChoice, REORDER|CANCEL
GuiControl, Choose, ReasonChoice, 1
GuiControl, Choose, ReorderChoice, 1
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcbx% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcbx%
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcby% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcby%
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcba% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcba%
PostMessage, 0x153, -1, %DropDownAH%,, ahk_id %hcbb% ; Set height of selection field.
PostMessage, 0x153, 0, %DropDownBH%,, ahk_id %hcbb%
GuiControl, Choose, DepartmentChoice, 6
GuiControl, Choose, RouteChoice, 6
Gui, Add, CheckBox, 0x1000 -Theme x%DEPT3X% y%DEPT3Y% w%DEPT3W% h%DEPT3H% vDept3, DEPARTMENT 3
Gui, Add, CheckBox, 0x1000 -Theme x%DEPT4X% y%DEPT4Y% w%DEPT4W% h%DEPT4H% vDept4, DEPARTMENT 4
Gui, Add, CheckBox, 0x1000 -Theme x%DEPT5X% y%DEPT5Y% w%DEPT5W% h%DEPT5H% vDept5, DEPARTMENT 5
Gui, Add, GroupBox, x%InvScannerX% y%InvScannerY% w%InvScannerW% h%InvScannerH%, Invoice Scanner
Gui, Add, Edit, x%InvScanEditX% y%InvScanEditY% w%InvScanEditW% h%InvScanEditH% -E0x200 vInvoiceScanEdit hwndHED1
Gui, Add, Button, Hidden Default, OK
GuiControl, Move, InvoiceScanEdit, x%MovInvScanEditX% y%MovInvScanEditY% w%MovInvScanEditW% h%MovInvScanEditH%
GuiControl, +Center 0x200 -VScroll -HScroll, InvoiceScanEdit
Gui, Add, GroupBox, x%GroupResultsX% y%GroupResultsY% w%GroupResultsW% h%GroupResultsH%, Results
Gui, Add, Text, x%ResDiagX% y%ResDiagY% w%ResDiagW% h%ResDiagH% 0x1000 vResultDialog, Stand-by for result.
Gui, Font, cBlue
Gui, Add, Text, x%SetPrintersX% y%SetPrintersY%, Set Printers
Gui, Font,
GuiControl, Hide, GroupOrderPacked
GuiControl, Hide, PackerReport
GuiControl, Hide, GroupHandedOver
GuiControl, Hide, HandOverReport
GuiControl, Hide, RouteChoice
GuiControl, Hide, DepartmentChoice
;GuiControl, Hide, Dept5
GuiControl, Hide, GroupReturned
GuiControl, Hide, ReasonChoice
GuiControl, Hide, ReorderChoice
GuiControl, Hide, PrintLabelsONOFF
GuiControl, Hide, LabelsChromeONOFF
GuiControl, Hide, PrintPackerReportONOFF
GuiControl, Hide, PackerReportChromeONOFF
GuiControl, Hide, PrintHandOverReportONOFF
GuiControl, Hide, HandOverReportChromeONOFF
GuiControl, Hide, CurrentUser
GuiControl, Hide, ChangeUser
Gui, Show, x0 y0 h%ScreenHeight% w%ScreenWidth%, Pack Tracking
Return
Who is online
Users browsing this forum: Bing [Bot], Chunjee, DRS, Tio_oddish and 77 guests