[Resolved] Assistance with reading multiple radio button values from an ini file

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Desdichado
Posts: 11
Joined: 04 Jun 2015, 16:57

[Resolved] Assistance with reading multiple radio button values from an ini file

24 Jun 2017, 00:04

Hello All,

I am working on my first major AHK project (that I've been working on for the last couple of years) and have decided to add additional functionality to it.

I am attempting to add a configuration tab to the gui script/app that writes setting values to an ini file that the app will then read when it is opened.

I have cobbled the code together using examples found in the forum and adding in my own code to it. I'm sure it looks horrible, but I'm still learning.

I had successfully written the values of a number of radio buttons to an ini file at one point, but I have been unsuccessful in all my attempts to get the ini file to read upon running the script. Also, now when I attempt to write/úpdate the ini file, it is not saving and I have no idea where I veered off track. Please find my code below:

Code: Select all

Gui Tab, 1

Func(TabButtons)

S1ConfigArray := []	; Initializes array to contain default printer name list ("Printer_List.txt") upon application open.
S1ConfigList := ""
loop, read, C:\Site1SC.txt	;	Refers to variable containing path to "Printer_List.txt" file.
	S1ConfigArray.Insert(A_LoopReadLine)

for key, val in S1ConfigArray
	S1ConfigList .= val  "|"

Site1		:= S1ConfigArray[1]
Site1Acr 	:= S1ConfigArray[2]
S1OFF01 	:= S1ConfigArray[3]
S1OFF02 	:= S1ConfigArray[4]
S1OFF03 	:= S1ConfigArray[5]
S1OFF04 	:= S1ConfigArray[6]
S1OFF05		:= S1ConfigArray[7]
S1OFF06		:= S1ConfigArray[8]
S1OFF07		:= S1ConfigArray[9]
S1OFF08		:= S1ConfigArray[10]

I=36                 ;- total checkboxes

Loop, %i%
   {
    If (RB%A_Index% = 1)
       RB%A_Index% = Checked
    Else
       RB%A_Index% =
   }
   
Loop {
	GuiControlGet, Radio, , RB%A_Index%
	If Check =
		{
		Count := (RB%A_Index%-1)
		Break
	}
}

;this loop reads the ini then updates the gui by guicontrol
IfExist, C:\Site5RB.txt 
	Loop, %COUNT% {
		
		value := RB%A_Index%
		Iniread, RB%A_Index%, C:\Site5RB.txt, Check, RB%A_index%
		value := RB%A_Index%
		GuiControl, , RB%A_Index%, %value%
}

Gui, Add, Text, x19 y213, On
Gui, Add, Text, x53 y213, Off
Gui, Add, Text, x89	y213, Default?
Gui, Add, Text, x150 y213, Unit Abbr.
Gui, Add, Edit, x180 y173 w250 h17 vSite1, %Site1%	; Name of Site 1
Gui, Add, Text, x100 y175, Site 5 Name:
Gui, Add, Edit, x550 y173 w50 h17 vSite1Acr, %Site1Acr%	; Site 1 Acronym
Gui, Add, Text, x450 y175, Site 5 Acronym:

Gui, Add, Radio, x20 y235 vRB1 %RB1% cBlack
Gui, Add, Radio, x55 yp+0 vRB2 %RB2% cBlack
Gui, Add, CheckBox, xp+50 yp+0 vCB1 %CB1% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF01, %S1OFF01%

Gui, Add, Radio, x20 yp+27 vRB3 %RB3% cBlack,
Gui, Add, Radio, x55 yp+0 vRB4 %RB4% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB2 %CB2% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF02, %S1OFF02%

Gui, Add, Radio, x20 yp+27 vRB5 %RB5% cBlack,
Gui, Add, Radio, x55 yp+0 vRB6 %RB6% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB3 %CB3% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF03, %S1OFF03%

Gui, Add, Radio, x20 yp+27 vRB7 %RB7% cBlack,
Gui, Add, Radio, x55 yp+0 vRB8 %RB8% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB4 %CB4% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF04, %S1OFF04%

Gui, Add, Radio, x20 yp+27 vRB9 %RB9% cBlack,
Gui, Add, Radio, x55 yp+0 vRB10 %RB10% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB5 %CB5% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF05, %S1OFF05%

Gui, Add, Radio, x20 yp+27 vRB11 %RB11% cBlack,
Gui, Add, Radio, x55 yp+0 vRB12 %RB12% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB6 %CB6% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF06, %S1OFF06%

Gui, Add, Radio, x20 yp+27 vRB13 %RB13% cBlack,
Gui, Add, Radio, x55 yp+0 vRB14 %RB14% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB7 %CB7% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF07, %S1OFF07%

Gui, Add, Radio, x20 yp+27 vRB15 %RB15% cBlack,
Gui, Add, Radio, x55 yp+0 vRB16 %RB16% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB8 %CB8% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF08, %S1OFF08%

Gui, Add, Button, x850 y725 w75 h30, SaveS1SC
GuiControl, Text, SaveS1SC, Save Site 1
Gui, Add, Button, x940 y725 w75 h30, Exit
The variables for the radio buttons that I am attempting to read are %RB1%, %RB2%, %RB3%, %RB4%, etc. Each of the radio buttons are paired, with %RB1% denoting "On", %RB2% denoting "Off", etc. These values will eventually be utilized to unhide hidden gui controls on other tabs.

Any assistance would be greatly appreciated. Also, any constructive criticism of my code would be awesome. I've posted my entire code at the end, if anyone is interested and would be kind enough to offer input.

Thanks,

Desdichado

Code: Select all

#NoEnv
#Persistent
#SingleInstance force
SetBatchLines, -1

Gui  -Resize +MinimizeBox -MaximizeBox -AlwaysOnTop +Enabled
Gui, Color, FFFFFF
Gui, font, Bold s10 Andale Mono
Gui, Add, Tab2,buttons w100 vTAB_BUTTON x-100, 1|2|3|4|5|6  ; note that the position is x-100, so it wont show up in the gui

GuiControl, +default, Exit
Gui, Show, w1024 h768, %OrgName% - Print Documents Tool

; -------------------------- Site 1 Configuration Tab ------------------------------------------------------------------------------------------------------------------------
Gui Tab, 1

Func(TabButtons)

S1ConfigArray := []	; Initializes array to contain default printer name list ("Printer_List.txt") upon application open.
S1ConfigList := ""
loop, read, C:\Site1SC.txt	;	Refers to variable containing path to "Printer_List.txt" file.
	S1ConfigArray.Insert(A_LoopReadLine)

for key, val in S1ConfigArray
	S1ConfigList .= val  "|"

Site1		:= S1ConfigArray[1]
Site1Acr 	:= S1ConfigArray[2]
S1OFF01 	:= S1ConfigArray[3]
S1OFF02 	:= S1ConfigArray[4]
S1OFF03 	:= S1ConfigArray[5]
S1OFF04 	:= S1ConfigArray[6]
S1OFF05		:= S1ConfigArray[7]
S1OFF06		:= S1ConfigArray[8]
S1OFF07		:= S1ConfigArray[9]
S1OFF08		:= S1ConfigArray[10]

I=36                 ;- total checkboxes

Loop, %i%
   {
    If (RB%A_Index% = 1)
       RB%A_Index% = Checked
    Else
       RB%A_Index% =
   }
   
Loop {
	GuiControlGet, Radio, , RB%A_Index%
	If Check =
		{
		Count := (RB%A_Index%-1)
		Break
	}
}

;this loop reads the ini then updates the gui by guicontrol
IfExist, C:\Site5RB.txt 
	Loop, %COUNT% {
		
		value := RB%A_Index%
		Iniread, RB%A_Index%, C:\Site5RB.txt, Check, RB%A_index%
		value := RB%A_Index%
		GuiControl, , RB%A_Index%, %value%
}

Gui, Add, Text, x19 y213, On
Gui, Add, Text, x53 y213, Off
Gui, Add, Text, x89	y213, Default?
Gui, Add, Text, x150 y213, Unit Abbr.
Gui, Add, Edit, x180 y173 w250 h17 vSite1, %Site1%	; Name of Site 1
Gui, Add, Text, x100 y175, Site 5 Name:
Gui, Add, Edit, x550 y173 w50 h17 vSite1Acr, %Site1Acr%	; Site 1 Acronym
Gui, Add, Text, x450 y175, Site 5 Acronym:

Gui, Add, Radio, x20 y235 vRB1 %RB1% cBlack
Gui, Add, Radio, x55 yp+0 vRB2 %RB2% cBlack
Gui, Add, CheckBox, xp+50 yp+0 vCB1 %CB1% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF01, %S1OFF01%

Gui, Add, Radio, x20 yp+27 vRB3 %RB3% cBlack,
Gui, Add, Radio, x55 yp+0 vRB4 %RB4% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB2 %CB2% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF02, %S1OFF02%

Gui, Add, Radio, x20 yp+27 vRB5 %RB5% cBlack,
Gui, Add, Radio, x55 yp+0 vRB6 %RB6% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB3 %CB3% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF03, %S1OFF03%

Gui, Add, Radio, x20 yp+27 vRB7 %RB7% cBlack,
Gui, Add, Radio, x55 yp+0 vRB8 %RB8% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB4 %CB4% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF04, %S1OFF04%

Gui, Add, Radio, x20 yp+27 vRB9 %RB9% cBlack,
Gui, Add, Radio, x55 yp+0 vRB10 %RB10% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB5 %CB5% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF05, %S1OFF05%

Gui, Add, Radio, x20 yp+27 vRB11 %RB11% cBlack,
Gui, Add, Radio, x55 yp+0 vRB12 %RB12% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB6 %CB6% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF06, %S1OFF06%

Gui, Add, Radio, x20 yp+27 vRB13 %RB13% cBlack,
Gui, Add, Radio, x55 yp+0 vRB14 %RB14% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB7 %CB7% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF07, %S1OFF07%

Gui, Add, Radio, x20 yp+27 vRB15 %RB15% cBlack,
Gui, Add, Radio, x55 yp+0 vRB16 %RB16% cBlack,
Gui, Add, CheckBox, xp+50 yp+0 vCB8 %CB8% cBlack,
Gui, Add, Edit, x150 yp-2 w50 h17 vS1OFF08, %S1OFF08%

Gui, Add, Button, x850 y725 w75 h30, SaveS1SC
GuiControl, Text, SaveS1SC, Save Site 1
Gui, Add, Button, x940 y725 w75 h30, Exit

; -------------------------- Begin of General Variables Section --------------------------------------------------------------------------------------------------------------
OrgName = Initech Software			; Defines name organization
OrgAcr = ISC						; Defines acronym/abbreviation organization
Site1 = Site 1	; Defines name of Site 1
Site1Acr = ISC1							; Defines acronym/abbreviation for Site 1


; File Path Variables
Folder = C:\ISC_Test_Files\TPS_Report_RTFs
S1PrtrList = C:\ISC_Test_Files\ISC_Printer_List.txt

; Site 1 Office Name Variables
S1OFF01 = A01
S1OFF02 = A02
S1OFF03 = A03
S1OFF04 = A04
S1OFF05 = A05
S1OFF06 = A06
S1OFF07 = A07
S1OFF08 = A08

; Office Report File Name Variables ("cascading" variables created utilizing Office Name Variables defines in section above.)
S1OFF01FN = TPSRPT%S1OFF01%.rtf
S1OFF02FN = TPSRPT%S1OFF02%.rtf
S1OFF03FN = TPSRPT%S1OFF03%.rtf
S1OFF04FN = TPSRPT%S1OFF04%.rtf
S1OFF05FN = TPSRPT%S1OFF05%.rtf
S1OFF06FN = TPSRPT%S1OFF06%.rtf
S1OFF07FN = TPSRPT%S1OFF07%.rtf
S1OFF08FN = TPSRPT%S1OFF08%.rtf

S1OFF01FNPA = %Folder%\%S1OFF01FN%	; Defines Site 1, Office 01, File Name\Path Alias, e.g., variable contains "C:\AWC_Test_Files\TPS_Report_RTFs\" & "TPSRPTOFF01.rtf"
S1OFF02FNPA = %Folder%\%S1OFF02FN%
S1OFF03FNPA = %Folder%\%S1OFF03FN%
S1OFF04FNPA = %Folder%\%S1OFF04FN%
S1OFF05FNPA = %Folder%\%S1OFF05FN%
S1OFF06FNPA = %Folder%\%S1OFF06FN%
S1OFF07FNPA = %Folder%\%S1OFF07FN%
S1OFF08FNPA = %Folder%\%S1OFF08FN%

; -------------------------- End of General Variables Section ----------------------------------------------------------------------------------------------------------------
; ----------------------------------------------------------- Begin Site 1 Distributive Tab ----------------------------------------------------------------------

Gui Tab, 2
Gui, font, Bold s9 Andale Mono

Func(TabButtons)

I=36                 ;- total checkboxes

Loop,%i%
   {
   ; IniRead, Ch%A_Index%, %f1%, ss, Cb%A_Index% , 0
    If (S1UCh%A_Index% = 1)
       S1UCb%A_Index% = Checked
    Else
       S1UCb%A_Index% =
   }

Gui, font, Bold s8 Andale Mono
Gui, Add, Button, x287 y170 w450 %ALLSite1_U%, ALLSite1_U
GuiControl Text, ALLSite1_U, Print ALL %Site1% TPS Reports - NETWORK UP
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y225 w50 %S1OFF01_U%, S1OFF01_U
Gui, Add, CheckBox, x25 y228 vS1UCh1 %S1Ucb01% cBlack, Print TPS Reports for %Site1% %S1OFF01% ONLY
GuiControl Text, S1OFF01_U, %S1OFF01%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y250 w50 %S1OFF02_U%, S1OFF02_U
Gui, Add, CheckBox, x25 y253 vS1UCh2 %S1Ucb2% cBlack, Print TPS Reports for %Site1% %S1OFF02% ONLY
GuiControl Text, S1OFF02_U, %S1OFF02%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y275 w50 %S1OFF03_U%, S1OFF03_U
Gui, Add, CheckBox, x25 y278 vS1UCh3 %S1Ucb3% cBlack, Print TPS Reports for %Site1% %S1OFF03% ONLY
GuiControl Text, S1OFF03_U, %S1OFF03%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y300 w50 %S1OFF04_U%, S1OFF04_U
Gui, Add, CheckBox, x25 y303 vS1UCh4 %S1Ucb4% cBlack, Print TPS Reports for %Site1% %S1OFF04% ONLY
GuiControl Text, S1OFF04_U, %S1OFF04%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y325 w50 %S1OFF05_U%, S1OFF05_U
Gui, Add, CheckBox, x25 y328 vS1UCh5 %S1Ucb5% cBlack, Print TPS Reports for %Site1% %S1OFF05% ONLY
GuiControl Text, S1OFF05_U, %S1OFF05%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y350 w50 %S1OFF06_U%, S1OFF06_U
Gui, Add, CheckBox, x25 y353 vS1UCh6 %S1Ucb6% cBlack, Print TPS Reports for %Site1% %S1OFF06% ONLY
GuiControl Text, S1OFF06_U, %S1OFF06%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y375 w50 %S1OFF07_U%, S1OFF07_U
Gui, Add, CheckBox, x25 y378 vS1UCh7 %S1Ucb7% cBlack, Print TPS Reports for %Site1% %S1OFF07% ONLY
GuiControl Text, S1OFF07_U, %S1OFF07%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x405 y400 w50 %S1OFF08_U%, S1OFF08_U
Gui, Add, CheckBox, x25 y403 vS1UCh8 %S1Ucb7% cBlack, Print TPS Reports for %Site1% %S1OFF08% ONLY
GuiControl Text, S1OFF08_U, %S1OFF08%
; --------------------------------------------------------------------------------------------------
Gui, Add, CheckBox, x25 y675 vS1UCh98 gCheckAllS1U   cBlack, Select All Units
Gui, Add, CheckBox, x25 y700 vS1UCh99 gUnCheckAllS1U cBlack, De-Select All Units

Gui, Add, Button, x940 y725 w75 h30, Exit																													; y950
GuiControl, +default, Exit

Gui, font, s24 Andale Mono
Gui, Add, Text, x210 y110, Print %Site1Acr% TPS Reports - Network UP
;---------------------------------------------------------- End Distributive Printing Tab -------------------------------------------------------------------------------
; --------------------------------------------------------- Begin Centralized Printing Tab ------------------------------------------------------------------------------

Gui Tab, 3
Gui, font, Bold s9 Andale Mono

Func(TabButtons)

I=36                 ;- total checkboxes

Loop,%i%
   {
   ; IniRead, Ch%A_Index%, %f1%, ss, Cb%A_Index% , 0
    If (S1DCh%A_Index% = 1)
       S1DCb%A_Index% = Checked
    Else
       S1DCb%A_Index% =
   }

Gui, font, s8 Andale Mono
Gui, font, Bold, s8, Andale Mono
Gui, Add, Button, x287 y170 w450 %ALLSite1_D%, ALLSite1_D
GuiControl Text, ALLSite1_D, Print ALL %Site1% TPS Reports - NETWORK DOWN

Gui, Add, Button, x25 y225 w50 %S1OFF01_D%, S1OFF01_D
Gui, Add, CheckBox, x100 y228 vS1DCh1 %S1Dcb1% cBlack, <----- Print TPS Reports for %Site1% %S1OFF01% ONLY
GuiControl Text, S1OFF01_D, %S1OFF01%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x25 y250 w50 %S1OFF02_D%, S1OFF02_D
Gui, Add, CheckBox, x100 y253 vS1DCh2 %S1Dcb2% cBlack, <----- Print TPS Reports for %Site1% %S1OFF02% ONLY
GuiControl Text, S1OFF02_D, %S1OFF02%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x25 y275 w50 %S1OFF03_D%, S1OFF03_D
Gui, Add, CheckBox, x100 y278 vS1DCh3 %S1Dcb3% cBlack, <----- Print TPS Reports for %Site1% %S1OFF03% ONLY
GuiControl Text, S1OFF03_D, %S1OFF03%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x25 y300 w50 %S1OFF04_D%, S1OFF04_D
Gui, Add, CheckBox, x100 y303 vS1DCh4 %S1Dcb4% cBlack, <----- Print TPS Reports for %Site1% %S1OFF04% ONLY
GuiControl Text, S1OFF04_D, %S1OFF04%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x25 y325 w50 %S1OFF05_D%, S1OFF05_D
Gui, Add, CheckBox, x100 y328 vS1DCh5 %S1Dcb5% cBlack, <----- Print TPS Reports for %Site1% %S1OFF05% ONLY
GuiControl Text, S1OFF05_D, %S1OFF05%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x25 y350 w50 %S1OFF06_D%, S1OFF06_D
Gui, Add, CheckBox, x100 y353 vS1DCh6 %S1Dcb6% cBlack, <----- Print TPS Reports for %Site1% %S1OFF06% ONLY
GuiControl Text, S1OFF06_D, %S1OFF06%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x25 y375 w50 %S1OFF07_D%, S1OFF07_D
Gui, Add, CheckBox, x100 y378 vS1DCh7 %S1Dcb7% cBlack, <----- Print TPS Reports for %Site1% %S1OFF07% ONLY
GuiControl Text, S1OFF07_D, %S1OFF07%
; --------------------------------------------------------------------------------------------------
Gui, Add, Button, x25 y400 w50 %S1OFF08_D%, S1OFF08_D
Gui, Add, CheckBox, x100 y403 vS1DCh8 %S1Dcb7% cBlack, <----- Print TPS Reports for %Site1% %S1OFF08% ONLY
GuiControl Text, S1OFF08_D, %S1OFF08%
; --------------------------------------------------------------------------------------------------

Gui,1:  Add, CheckBox, x100 y675 vS1DCh98 gCheckAllS1D   cBlack, Select All Units
Gui,1:  Add, CheckBox, x100 y700 vS1DCh99 gUnCheckAllS1D cBlack, De-Select All Units

Gui, Add, Button, x940 y725 w75 h30, Exit	
GuiControl, +default, Exit

Gui, font, s24, Andale Mono
Gui, Add, Text, x180 y110, Print %Site1Acr% TPS Reports - Network DOWN
; ------------------------------------------------------- End Centralized Printing Tab ---------------------------------------------------------------------------------
; ---------------------------------------------------- Begin Different Printer Settings Tab ----------------------------------------------------------------------------

Gui Tab, 4
Gui, font, Bold s9 Andale Mono

Func(TabButtons)

Gui, font, s8 Andale Mono
; ----------------------------------------------------------------------
Loop, READ, %Site1PrtrList%
{
	Site1Printer%A_Index% := A_LoopReadLine
	Site1DDLPrinterList .= "|"Site1Printer%A_Index%
}
Gui, Add, Text, x25 y170, Select %Site1Acr% %S1OFF01% printer
Gui, Add, Button, x410 y165 w75 h25 %S1OFF01_BP%, S1OFF01_BP
GuiControl Text, S1OFF01_BP, Print %S1OFF01% 
Gui, Add, DropDownList, x170 y168 w225 vS1OFF01DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y155 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y205, Select %Site1Acr% %S1OFF02% printer
Gui, Add, Button, x410 y200 w75 h25 %S1OFF02_BP%, S1OFF02_BP
GuiControl Text, S1OFF02_BP, Print %S1OFF02%
Gui, Add, DropDownList, x170 y203 w225 vS1OFF02DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y190 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y240, Select %Site1Acr% %S1OFF03% printer
Gui, Add, Button, x410 y235 w75 h25 %S1OFF03_BP%, S1OFF03_BP
GuiControl Text, S1OFF03_BP, Print %S1OFF03%
Gui, Add, DropDownList, x170 y238 w225 vS1OFF03DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y225 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y275, Select %Site1Acr% %S1OFF04% printer
Gui, Add, Button, x410 y270 w75 %S1OFF04_BP%, S1OFF04_BP
GuiControl Text, S1OFF04_BP, Print %S1OFF04%
Gui, Add, DropDownList, x170 y273 w225 vS1OFF04DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y260 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y310, Select %Site1Acr% %S1OFF05% printer
Gui, Add, Button, x410 y305 w75 %S1OFF05_BP%, S1OFF05_BP
GuiControl Text, S1OFF05_BP, Print %S1OFF05%
Gui, Add, DropDownList, x170 y308 w225 vS1OFF05DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y295 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y345, Select %Site1Acr% %S1OFF06% printer
Gui, Add, Button, x410 y340 w75 %S1OFF06_BP%, S1OFF06_BP
GuiControl Text, S1OFF06_BP, Print %S1OFF06%
Gui, Add, DropDownList, x170 y343 w225 vS1OFF06DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y330 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y380, Select %Site1Acr% %S1OFF07% printer
Gui, Add, Button, x410 y375 w75 %S1OFF07_BP%, S1OFF07_BP
GuiControl Text, S1OFF07_BP, Print %S1OFF07%
Gui, Add, DropDownList, x170 y378 w225 vS1OFF07DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y365 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y415, Select %Site1Acr% %S1OFF08% printer
Gui, Add, Button, x410 y410 w75 %S1OFF08_BP%, S1OFF08_BP
GuiControl Text, S1OFF08_BP, Print %S1OFF08%
Gui, Add, DropDownList, x170 y413 w225 vS1OFF08DP, %Site1DDLprinterlist%
Gui, Add, GroupBox, x20 y400 w475 h40
; ----------------------------------------------------------------------

Gui, Add, Button, x940 y725 w75 h30, Exit	

Gui, font, s24, Andale Mono
Gui, Add, Text, x100 y110, Print %Site1% TPS Reports TO A DIFFERENT PRINTER
; --------------------------------------------------------------- End Different Printer Settings Tab ---------------------------------------------------------------------
; ---------------------------------------------------------------- Begin Printer Configuration Tab -----------------------------------------------------------------------
S1PrinterArray := []	; Initializes array to contain default printer name list ("Printer_List.txt") upon application open.
S1PrinterList := ""
loop, read, %S1PrtrList%		;	Refers to variable containing path to "Printer_List.txt" file.
	S1PrinterArray.Insert(A_LoopReadLine)

for key, val in S1PrinterArray
	S1PrinterList .= val  "|"

PCprtS1OFF01 	:= S1PrinterArray[1]
PCprtS1OFF02 	:= S1PrinterArray[2]
PCprtS1OFF03 	:= S1PrinterArray[3]
PCprtS1OFF04 	:= S1PrinterArray[4]
PCprtS1OFF05 	:= S1PrinterArray[5]
PCprtS1OFF06 	:= S1PrinterArray[6]
PCprtS1OFF07	:= S1PrinterArray[7]
PCprtS1OFF08	:= S1PrinterArray[8]
PCprtS1Local 	:= S1PrinterArray[9]
PcprtS1Default	:= S1PrinterArray[10]

Gui Tab, 5
Gui, font, Bold s9 Andale Mono

Func(TabButtons)

Gui, font, Bold s24 Andale Mono
GuiControl, +default, Exit

Gui, Add, Text, x320 y110, Printer Configuration - %Site1Acr%

Gui, font, s9 Andale Mono
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y180, Default printer for %Site1Acr% %S1OFF01%
Gui, Add, Edit, x195 y178 w260 vPCprtS1OFF01, %PCprtS1OFF01%
Gui, Add, GroupBox, x20 y165 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y215, Default printer for %Site1Acr% %S1OFF02%
Gui, Add, Edit, x195 y213 w260 vPCprtS1OFF02, %PCprtS1OFF02%
Gui, Add, GroupBox, x20 y200 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y250, Default printer for %Site1Acr% %S1OFF03%
Gui, Add, Edit, x195 y248 w260 vPCprtS1OFF03, %PCprtS1OFF03%
Gui, Add, GroupBox, x20 y235 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y285, Default printer for %Site1Acr% %S1OFF04%
Gui, Add, Edit, x195 y283 w260 vPCprtS1OFF04, %PCprtS1OFF04%
Gui, Add, GroupBox, x20 y270 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y320, Default printer for %Site1Acr% %S1OFF05%
Gui, Add, Edit, x195 y318 w260 vPCprtS1OFF05, %PCprtS1OFF05%
Gui, Add, GroupBox, x20 y305 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y355, Default printer for %Site1Acr% %S1OFF06%
Gui, Add, Edit, x195 y353 w260 vPCprtS1OFF06, %PCprtS1OFF06%
Gui, Add, GroupBox, x20 y340 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y390, Default printer for %Site1Acr% %S1OFF07%
Gui, Add, Edit, x195 y388 w260 vPCprtS1OFF07, %PCprtS1OFF07%
Gui, Add, GroupBox, x20 y375 w475 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y425 vS1OFF08PEdit, Default printer for %Site1Acr% %S1OFF08%
GuiControl, Hide, S1OFF08PEdit
Gui, Add, Edit, x195 y423 w260 vPCprtS1OFF08, %PCprtS1OFF08%
GuiControl, Hide, PCprtS1OFF08
Gui, Add, GroupBox, x20 y410 w475 h40 vPCprtS1OFF08GB
GuiControl, Hide, PCprtS1OFF08GB
; ----------------------------------------------------------------------
Gui, Add, Text, x25 y720, %Site1Acr% LOCAL printer
Gui, Add, Edit, x140 y718 w260 vPCprtS1Local, %PCprtS1Local%
Gui, Add, GroupBox, x20 y705 w390 h40
; ----------------------------------------------------------------------
Gui, Add, Text, x428 y720, %Site1Acr% DEFAULT printer
Gui, Add, Edit, x560 y718 w260 vPCprtS1Default, %PCprtS1Default%
Gui, Add, GroupBox, x420 y705 w410 h40


Gui, Add, Button, x850 y725 w75 h30, SaveS1PC
GuiControl, Text, SaveS1PC, Save %Site1Acr%
Gui, Add, Button, x940 y725 w75 h30, Exit	

Gui, font, Bold s11 Andale Mono
Gui, Add, Text, x525 y635, ***PLEASE NOTE:*** Changes to printer on this tab do not take effect
Gui, Add, Text, x525 y655, until after the "Save %Site1Acr%" button has been clicked AND the user exits
Gui, Add, Text, x525 y675, and re-opens the application.

; ----------------------------------------------------------------- End Printer Configuration Tab -------------------------------------------------------------------------
; ------------------------------------------------------------------- Begin File Status Monitor ---------------------------------------------------------------------------
; File/Time Functions w/ "cascading" variables:
FileGetTime, FTime%S1OFF01%, %Folder%\%S1OFF01FN%, M	; Retrieves date/time of most recent TPS Report file for Site 1, Office 01
FileGetTime, FTime%S1OFF02%, %Folder%\%S1OFF02FN%, M	;
FileGetTime, FTime%S1OFF03%, %Folder%\%S1OFF03FN%, M	;
FileGetTime, FTime%S1OFF04%, %Folder%\%S1OFF04FN%, M	;
FileGetTime, FTime%S1OFF05%, %Folder%\%S1OFF05FN%, M	;
FileGetTime, FTime%S1OFF06%, %Folder%\%S1OFF06FN%, M	;
FileGetTime, FTime%S1OFF07%, %Folder%\%S1OFF07FN%, M	;
FileGetTime, FTime%S1OFF08%, %Folder%\%S1OFF08FN%, M	;

FormatTime, FTimeA01, %FTimeA01%
FormatTime, FTimeA02, %FTimeA02%
FormatTime, FTimeA03, %FTimeA03%
FormatTime, FTimeA04, %FTimeA04%
FormatTime, FTimeA05, %FTimeA05%
FormatTime, FTimeA06, %FTimeA06%
FormatTime, FTimeA07, %FTimeA07%
FormatTime, FTimeA08, %FTimeA08%

Gui Tab, 6
Gui, font, Bold s9 Andale Mono

Func(TabButtons)

Gui, Font, s24 Andale Mono
Gui, Add, Text, x320 y110, File Status Monitor - %Site1Acr%

Gui, Font, s7, Andale Mono
Gui, Add, Button, x940 y725 w75 h30, Exit	
GuiControl, +default, Exit

; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y170, File date/time for %Site1Acr% %S1OFF01%:
IfNotExist, %Folder%\%S1OFF01FN%
	Gui, Add, Text, cRed x190 y170, No File Found for %S1OFF01%!
else
{
FileGetTime, v%S1OFF01%ev, %Folder%\%S1OFF01FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, v%S1OFF01%ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y170, %FTimeA01% %S1OFF01% (%vNow% minutes old)!																	

}	
else
	Gui, Add, Text, x190 y170, %FTimeA01%
	}
vNow := ""
; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y195, File date/time for %Site1Acr% %S1OFF02%:
IfNotExist, %Folder%\%S1OFF02FN%
	Gui, Add, Text, cRed x190 y195, No File Found for %S1OFF02%!
else
{
FileGetTime, v%S1OFF02%ev, %Folder%\%S1OFF02FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, v%S1OFF02%ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y195, %FTimeA02% %S1OFF02% (%vNow% minutes old)!

}	
else
	Gui, Add, Text, x190 y195, %FTimeA02%
}
vNow := ""
; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y220, File date/time for %Site1Acr% %S1OFF03%:
IfNotExist, %Folder%\%S1OFF03FN%
	Gui, Add, Text, cRed x190 y220, No File Found for %S1OFF03%!
else
{
FileGetTime, v%S1OFF03%ev, %Folder%\%S1OFF03FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, v%S1OFF03%ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y220, %FTimeA03% %S1OFF03% (%vNow% minutes old)!
}	
else
	Gui, Add, Text, x190 y220, %FTimeA03%
}
vNow := ""
; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y245, File date/time for %Site1Acr% %S1OFF04%:
IfNotExist, %Folder%\%S1OFF04FN%
	Gui, Add, Text, cRed x190 y245, No File Found for %S1OFF04%!
else
{
FileGetTime, vS1OFF04ev, %Folder%\%S1OFF04FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, vS1OFF04ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y245, %FTimeA04% %S1OFF04% (%vNow% minutes old)!
}	
else
	Gui, Add, Text, x190 y245, %FTimeA04%
}
vNow := ""
; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y270, File date/time for %Site1Acr% %S1OFF05%:
IfNotExist, %Folder%\%S1OFF05FN%
	Gui, Add, Text, cRed x190 y270, No File Found for %S1OFF05%!
else
{
FileGetTime, v%S1OFF05%ev, %Folder%\%S1OFF05FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, v%S1OFF05%ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y270, %FTimeA05% %S1OFF05% (%vNow% minutes old)!
}	
else
	Gui, Add, Text, x190 y270, %FTimeA05%
}
vNow := ""
; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y295, File date/time for %Site1Acr% %S1OFF06%:
IfNotExist, %Folder%\%S1OFF06FN%
	Gui, Add, Text, cRed x190 y295, No File Found for %S1OFF06%!
else
{
FileGetTime, v%S1OFF06%ev, %Folder%\%S1OFF06FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, v%S1OFF06%ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y295, %FTimeA06% %S1OFF06% (%vNow% minutes old)!
}	
else
	Gui, Add, Text, x190 y295, %FTimeA06%
}
vNow := ""
; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y320, File date/time for %Site1Acr% %S1OFF07%:
IfNotExist, %Folder%\%S1OFF07FN%
	Gui, Add, Text, cRed x190 y320, No File Found for %S1OFF07%!
else
{
FileGetTime, v%S1OFF07%ev, %Folder%\%S1OFF07FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, v%S1OFF07%ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y320, %FTimeA07% %S1OFF07% (%vNow% minutes old)!
}	
else
	Gui, Add, Text, x190 y320, %FTimeA07%
}
vNow := ""
; ------------------------------------------------------------------------------------------------------
Gui, Add, Text, x20 y345, File date/time for %Site1Acr% %S1OFF08%:
IfNotExist, %Folder%\%S1OFF08FN%
	Gui, Add, Text, cRed x190 y345, No File Found for %S1OFF08%!
else
{
FileGetTime, v%S1OFF08%ev, %Folder%\%S1OFF08FN%, M ; Retrieves the file modified time.
vNow = %A_Now% ; replace current time variable with var2
EnvSub, vNow, v%S1OFF08%ev, minutes ; variables = days // subtract the two
If vNow > 60
{
	Gui, Add, Text, cRed x190 y345, %FTimeA08% %S1OFF08% (%vNow% minutes old)!
}	
else
	Gui, Add, Text, x190 y345, %FTimeA08%
}
vNow := ""
; -----------------------------------------------------------------------------------------------------------------------------------------------------------
; ------------------------------------------- Functions -----------------------------------------------------------------------------------------------------

Func(TabButtons)
{
	global
	Gui, font, s8, Andale Mono
	Gui, Add, Button, x10 y00 w165 h22, Site1_1
	GuiControl Text, Site1_1, Print to Offices - %Site1Acr%
	Gui, Add, Button, xp+175 y00 wp+0 h22, Site1_2
	GuiControl Text, Site1_2, Print to Local Printer - %Site1Acr%
	Gui, Add, Button, xp+175 y00 wp+0 h22, Site1_3
	GuiControl Text, Site1_3, Print to Diff. Printer - %Site1Acr%
	Gui, Add, Button, xp+175 y00 wp+0 h22, Site1_4
	GuiControl Text, Site1_4, Printer Config - %Site1Acr%
	Gui, Add, Button, xp+175 y00 wp+0 h22, Site1_5
	GuiControl Text, Site1_5, Site Config - %Site1Acr%
	Gui, Add, Button, xp+175 y00 wp+0 h22, Site1_6
	GuiControl Text, Site1_6, File Status Monitor - %Site1Acr%

	Gui, Add, Button, x10 yp+27 wp+0 h22, Site2_1
	GuiControl Text, Site2_1, Print to Offices - %Site2Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site2_2
	GuiControl Text, Site2_2, Print to Local Printer - %Site2Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site2_3
	GuiControl Text, Site2_3, Print to Diff. Printer - %Site2Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site2_4
	GuiControl Text, Site2_4, Printer Configuration - %Site2Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site2_5
	GuiControl Text, Site2_5, Site Config - %Site2Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site2_6
	GuiControl Text, Site2_5, File Status Monitor - %Site2Acr%
	
	Gui, Add, Button, x10 yp+27 wp+0 h22, Site4_1
	GuiControl Text, Site4_1, Print to Offices - %Site4Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site4_2
	GuiControl Text, Site4_2, Print to Local Printer - %Site4Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site4_3
	GuiControl Text, Site4_3, Print to Diff. Printer - %Site4Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site4_4
	GuiControl Text, Site4_4, Printer Configuration - %Site4Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site4_5
	GuiControl Text, Site4_5, Site Config - %Site4Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site4_6
	GuiControl Text, Site4_5, File Status Monitor - %Site4Acr%

	Gui, Add, Button, x10 yp+27 wp+0 h22, Site5_1
	GuiControl Text, Site5_1, Print to Offices - %Site5Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site5_2
	GuiControl Text, Site5_2, Print to Local Printer - %Site5Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site5_3
	GuiControl Text, Site5_3, Print to Diff. Printer - %Site5Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site5_4
	GuiControl Text, Site5_4, Printer Configuration - %Site5Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site5_5
	GuiControl Text, Site5_5, Site Config - %Site5Acr%
	Gui, Add, Button, xp+175 yp+0 wp+0 h22, Site5_6
	GuiControl Text, Site5_5, File Status Monitor - %Site5Acr%
}

;-------------------------------------- Button Code -------------------------------------------------------------------------------------------

ButtonSite1_1:
GuiControl, Choose, TAB_BUTTON, 2
return

ButtonSite1_2:
GuiControl, Choose, TAB_BUTTON, 3
return

ButtonSite1_3:
GuiControl, Choose, TAB_BUTTON, 4
return

ButtonSite1_4:
GuiControl, Choose, TAB_BUTTON, 5
return

ButtonSite1_5:
GuiControl, Choose, TAB_BUTTON, 1
return

ButtonSite1_6:
GuiControl, Choose, TAB_BUTTON, 6
return

ButtonExit:
Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Default%"
; Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS2Default%"
; Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS4Default%"
; Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS5Default%"
;Sleep 2000
ExitApp

GuiClose:
Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Default%"
; Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS2Default%"
; Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS4Default%"
; Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS5Default%"
;Sleep 2000
ExitApp
; --------------------------------------------------------- Begin Printer Configuration Save Buttons Code -------------------------------------------------------
ButtonSaveS1PC:
Gui, Submit, NoHide
FileDelete, %S1PrtrList%
FileAppend, %PCprtS1OFF01%`n%PCprtS1OFF02%`n%PCprtS1OFF03%`n%PCprtS1OFF04%`n%PCprtS1OFF05%`n%PCprtS1OFF06%`n%PCprtS1OFF07%`n%PCprtS1OFF08%`n%PCprtS1OFF09%`n%PCprtS1OFF10%`n%PCprtS1OFF11%`n%PCprtS1OFF12%`n%PCprtS1OFF13%`n%PCprtS1OFF14%`n%PCprtS1OFF15%`n%PCprtS1OFF16%`n%PCprtS1OFF17%`n%PCprtS1OFF18%`n%PCprtS1Local%`n%PCprtS1Default%, %S1PrtrList%
Return
; ---------------------------- Begin of Site Configuration Save Code ---------------------------------------------------------------------------------------------------------
ButtonSaveS1SC:
Gui, Submit, NoHide
FileDelete, C:\Site1SC.txt
FileAppend, %Site1%`n%Site1Acr%`n%S1OFF01%`n%S1OFF02%`n%S1OFF03%`n%S1OFF04%`n%S1OFF05%`n%S1OFF06%`n%S1OFF07%`n%S1OFF08%`n%S1OFF09%`n%S1OFF10%`n%S1OFF11%`n%S1OFF12%`n%S1OFF13%`n%S1OFF14%`n%S1OFF15%`n%S1OFF16%`n%S1OFF17%`n%S1OFF18%`n%S1OFF19%, C:\Site1SC.txt

Loop {
	GuiControlGet, Radio, , RB%A_Index%
	If Radio =
		{
		Count := (A_Index-1)
		Break
	}
}

; this loop writes the values found
Loop, %count% {
	value := RB%A_Index%
	IniWrite, %value%, C:\Site1RB.txt, Radio, RB%A_index%
}
Return

; ---------------------------- End of Site Configuration Save Code ---------------------------------------------------------------------------------------------------------


CheckAllS1U:
Loop, %i%
    GuiControl,1:, S1UCh%A_Index%, 1
GuiControl,1:, S1UCh99, 0
Return

UnCheckAllS1U:
Loop, %i%
    GuiControl,1:, S1UCh%A_Index%, 0
GuiControl,1:, S1UCh98, 0
Return

CheckAllS1D:
Loop, %i%
    GuiControl,1:, S1DCh%A_Index%, 1
GuiControl,1:, S1DCh99, 0
Return

UnCheckAllS1D:
Loop, %i%
    GuiControl,1:, S1DCh%A_Index%, 0
GuiControl,1:, S1DCh98, 0
Return


RB1:
if Hidden {
	GuiControl, Show, S1OFF01DPL
	GuiControl, Show, PCprtS1OFF01
	GuiControl, Show, S1OFF01PCGB
}
else {
	GuiControl, Hide, S1OFF01DPL
	GuiControl, Hide, PCprtS1OFF01
	GuiControl, Hide, S1OFF01PCGB
}
hidden:=not hidden
return

if %RB1% = 1
		{
		GuiControl, Show, S1OFF02DPL
		GuiControl, Show, PCprtS1OFF02
		GuiControl, Show, S1OFF02PCGB
		}
	else{
		GuiControl, Hide, S1OFF02DPL
		GuiControl, Hide, PCprtS1OFF02
		GuiControl, Hide, S1OFF02PCGB
		}

RB3:
if hidden {
	GuiControl, Show, S1OFF02DPL
	GuiControl, Show, PCprtS1OFF02
	GuiControl, Show, S1OFF02PCGB
}
else {
	GuiControl, Hide, S1OFF02DPL
	GuiControl, Hide, PCprtS1OFF02
	GuiControl, Hide, S1OFF02PCGB
}
hidden:=not hidden
return

RB5:
if hidden {
	GuiControl, Show, S1OFF03DPL
	GuiControl, Show, PCprtS1OFF03
	GuiControl, Show, S1OFF03PCGB
}
else {
	GuiControl, Hide, S1OFF03DPL
	GuiControl, Hide, PCprtS1OFF003
	GuiControl, Hide, S1OFF03PCGB
}
hidden:=not hidden
return

RB7:
if hidden {
	GuiControl, Show, S1OFF04DPL
	GuiControl, Show, PCprtS1OFF04
	GuiControl, Show, S1OFF04PCGB
}
else {
	GuiControl, Hide, S1OFF04DPL
	GuiControl, Hide, PCprtS1OFF04
	GuiControl, Hide, S1OFF04PCGB
}
hidden:=not hidden
return

RB9:
if hidden {
	GuiControl, Show, S1OFF05DPL
	GuiControl, Show, PCprtS1OFF05
	GuiControl, Show, S1OFF05PCGB
}
else {
	GuiControl, Hide, S1OFF05DPL
	GuiControl, Hide, PCprtS1OFF05
	GuiControl, Hide, S1OFF05PCGB
}
hidden:=not hidden
return

RB11:
if hidden {
	GuiControl, Show, S1OFF06DPL
	GuiControl, Show, PCprtS1OFF06
	GuiControl, Show, S1OFF06PCGB
}
else {
	GuiControl, Hide, S1OFF06DPL
	GuiControl, Hide, PCprtS1OFF06
	GuiControl, Hide, S1OFF06PCGB
}
hidden:=not hidden
return

RB13:
if hidden {
	GuiControl, Show, S1OFF07DPL
	GuiControl, Show, PCprtS1OFF07
	GuiControl, Show, S1OFF07PCGB
}
else {
	GuiControl, Hide, S1OFF07DPL
	GuiControl, Hide, PCprtS1OFF07
	GuiControl, Hide, S1OFF07PCGB
}
hidden:=not hidden
return

RB15:
if hidden {
	GuiControl, Show, S1OFF08PEdit
	GuiControl, Show, PCprtS1OFF08
	GuiControl, Show, PCprtS1OFF08GB
}
else {
	GuiControl, Hide, S1OFF08PEdit
	GuiControl, Hide, PCprtS1OFF08
	GuiControl, Hide, PCprtS1OFF08GB
}
hidden:=not hidden
return

ButtonALLSite1_U:
Gui, submit, nohide

  if S1UCh1
   gosub S1OFF01_PrintU
   Sleep 3500
  if S1UCh2
   gosub S1OFF02_PrintU
   Sleep 3500
  if S1UCh3
   gosub S1OFF03_PrintU
   Sleep 3500
  if S1UCh4
   gosub S1OFF04_PrintU
   Sleep 3500
  if S1UCh5
   gosub S1OFF05_PrintU
   Sleep 3500
  if S1UCh6
   gosub S1OFF06_PrintU
   Sleep 3500
  if S1UCh7
   gosub S1OFF07_PrintU
   Sleep 3500
  if S1UCh8
   gosub S1OFF08_PrintU
   Sleep 3500
  if S1UCh9
  return

; --------------------------- End of Combine Print Button Code for Network Up/Print to Nurse Station Distributive Printing Tab -----------------------------------------------
; ----------------------- Begin of Combined Print Button Code for Network Down/Print to Local Printer Centralized Printing Tab -----------------------------------------------

ButtonALLSite1_D:	; Prints All Buffalo Mercy Units - Network Down
Gui, Submit, NoHide
Sleep 1500

if S1DCh1
   gosub S1OFF01_PrintD
   Sleep 3500
  if S1DCh2
   gosub S1OFF02_PrintD
   Sleep 3500
  if S1DCh3
   gosub S1OFF03_PrintD
   Sleep 3500
  if S1DCh4
   gosub S1OFF04_PrintD
   Sleep 3500
  if S1DCh5
   gosub S1OFF05_PrintD
   Sleep 3500
  if S1DCh6
   gosub S1OFF06_PrintD
   Sleep 3500
  if S1DCh7
   gosub S1OFF07_PrintD
   Sleep 3500
  if S1DCh8
   gosub S1OFF08_PrintD
   Sleep 3500
  if S1DCh9
return

; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF01_PrintU:
ButtonS1OFF01_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF01FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF01FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF01%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF01%., 10, 17
			RunWait, print "%Folder%\%S1OFF01FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF02_PrintU:
ButtonS1OFF02_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF02FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF02FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF01%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF02%., 10, 17
			RunWait, print "%Folder%\%S1OFF02FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF03_PrintU:
ButtonS1OFF03_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF03FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF03FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF03%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF03%., 10, 17
			RunWait, print "%Folder%\%S1OFF03FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF04_PrintU:
ButtonS1OFF04_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF04FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF04FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF04%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF04%., 10, 17
			RunWait, print "%Folder%\%S1OFF04FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF05_PrintU:
ButtonS1OFF05_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF05FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF05FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF05%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF05%., 10, 17
			RunWait, print "%Folder%\%S1OFF05FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF06_PrintU:
ButtonS1OFF06_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF06FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF06FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF05%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF06%., 10, 17
			RunWait, print "%Folder%\%S1OFF06FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF07_PrintU:
ButtonS1OFF07_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF07FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF07FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF05%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF07%., 10, 17
			RunWait, print "%Folder%\%S1OFF07FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF08_PrintU:
ButtonS1OFF08_U:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF08FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF08FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1OFF08%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF08%., 10, 17
			RunWait, print "%Folder%\%S1OFF08FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

return
; ----------------------------------------- End Button Code for Distributive Printing ----------------------------------------------------------------------------------------
; ----------------------------------------- Begin Button Code for Centralized Printing ---------------------------------------------------------------------------------------
S1OFF01_PrintD:
ButtonS1OFF01_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF01FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF01FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF01%., 10, 17
			RunWait, print "%Folder%\%S1OFF01FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF02_PrintD:
ButtonS1OFF02_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF02FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF02FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF02%., 10, 17
			RunWait, print "%Folder%\%S1OFF02FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF03_PrintD:
ButtonS1OFF03_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF03FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF03FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF03%., 10, 17
			RunWait, print "%Folder%\%S1OFF03FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF04_PrintD:
ButtonS1OFF04_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF04FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF04FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF04%., 10, 17
			RunWait, print "%Folder%\%S1OFF04FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF05_PrintD:
ButtonS1OFF05_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF05FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF05FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
;			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF05%., 10, 17
			RunWait, print "%Folder%\%S1OFF05FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF06_PrintD:
ButtonS1OFF06_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF06FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF06FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF06%., 10, 17
			RunWait, print "%Folder%\%S1OFF06FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF07_PrintD:
ButtonS1OFF07_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF07FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF07FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF07%., 10, 17
			RunWait, print "%Folder%\%S1OFF07FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S1OFF08_PrintD:
ButtonS1OFF08_D:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF08FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF08FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF08%., 10, 17
			RunWait, print "%Folder%\%S1OFF08FN%"
			Sleep 3500
			}
		}
	}
}

return
; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
; ------------------------------------------ Begin of Select Different Printer - Offline/Broken Printer Tab -----------------------------------------------------------------------------------------

S1OFF01_BP:
ButtonS1OFF01_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF01FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF01FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF01DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF01%., 10, 17
			RunWait, print "%Folder%\%S1OFF01FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
S1OFF02_BP:
ButtonS1OFF02_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF02FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF02FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF02DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF02%., 10, 17
			RunWait, print "%Folder%\%S1OFF02FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
S1OFF03_BP:
ButtonS1OFF03_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF03FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF03FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF03DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF03%., 10, 17
			RunWait, print "%Folder%\%S1OFF03FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
S1OFF04_BP:
ButtonS1OFF04_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF04FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF04FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF04DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF04%., 10, 17
			RunWait, print "%Folder%\%S1OFF04FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
S1OFF05_BP:
ButtonS1OFF05_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF05FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF05FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF05DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF05%., 10, 17
			RunWait, print "%Folder%\%S1OFF05FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
S1OFF06_BP:
ButtonS1OFF06_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF06FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF06FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF06DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF06%., 10, 17
			RunWait, print "%Folder%\%S1OFF06FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
S1OFF07_BP:
ButtonS1OFF07_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF07FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF07FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF07DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF07%., 10, 17
			RunWait, print "%Folder%\%S1OFF07FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
S1OFF08_BP:
ButtonS1OFF08_BP:
Gui, Submit, NoHide
Sleep 1500

Loop, 1
{
	Loop, %Folder%\%S1OFF08FN%
	{
		FileGetTime, Time, %A_LoopFileFullPath%, C
		If (Time > Time_Orig)
		{
			Time_Orig := Time
			File := A_LoopFileName
		}
	}
	Loop, 1
	{
	Sleep 1000
	If (FileExist(S1OFF08FNPA))
		{
		Loop, %Folder%\%File%
			{
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%S1OFF08DP%"
			Sleep 1500
			TrayTip, %OrgAcr% » Printers and Faxes, Now printing TPS Reports for %Site1Acr% %S1OFF08%., 10, 17
			RunWait, print "%Folder%\%S1OFF08FN%"
			Sleep 3500
			Run RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%PCprtS1Local%"
			}
		}
	}
}

Return
; -------------------------------------------------------------------------------------------------------------------------------------------
Last edited by Desdichado on 27 Jun 2017, 09:21, edited 1 time in total.
User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Assistance with reading multiple radio button values from an ini file

24 Jun 2017, 09:17

It seems that at least one issue is that you are using the GuiControl command after the IniRead before those controls even exist. You don't define your GUI until after that, so your GuiControl commands aren't doing anything. Move that stuff to after the GUI definition.
Desdichado
Posts: 11
Joined: 04 Jun 2015, 16:57

Re: Assistance with reading multiple radio button values from an ini file

26 Jun 2017, 19:29

Hi Boiler,

Thank you the response. I am now correctly both saving and reading to the ini properly.

Thank you!

Desdichado

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Rohwedder and 125 guests