 							currBatchNo += 1
 
 						temp := PrgListIndex[A_Index]
-						PrgBdyBtchTog[A_Index] := MonStr(PrgMonToRn, temp)
+						PrgBdyBtchTog[A_Index] := MonStr(temp)
 						}
 						else
 						PrgBdyBtchTog[A_Index] := temp


		if (!waitBreak)
		{
			if (PrgMonToRn[selPrgChoice] != PrgLnch.Monitor)
			{
			SysGet, md, MonitorWorkArea, % PrgLnch.Monitor
			dx := Round(mdleft + (mdRight- mdleft)/2)

Gui, ActiveWindowProp: Font


Gui, ActiveWindowProp: Add, Groupbox, % "section" . " w" . 2.4*height . " R" . 2*visibleWindowHandlesNo

	loop %windowHandlesNo%
	{
		; Hidden windows are not considered
		if (winNames[A_Index])
		{
		Gui, ActiveWindowProp: Font, cA96915 Bold S9
		Gui, ActiveWindowProp: Add, text, % "xs+" . height/8 . " yp+" . height/18 . " w" . height, % winNames[A_Index]
		Gui, ActiveWindowProp: Font
		Gui, ActiveWindowProp: Add, Checkbox, % "xs+" . height/8 . " yp+" . height/8 . " w" . height . " vAWPPrgMinMax" . A_Index . " gAWPClick Check3", Min-Norm-Max
		GuiControl, ActiveWindowProp: Enable, % "AWPPrgMinMax" . A_Index
		WinGet, fTemp, MinMax , % "ahk_id" . PrgLnchOpt.GetTestWindowHandles(selPrgChoice, A_Index)
			if (fTemp == -1 )
			fTemp := 0
			else
			{
				if (!fTemp)
				fTemp := -1
			}
		

		GuiControl, ActiveWindowProp:, % "AWPPrgMinMax" . A_Index, %fTemp%
		Gui, ActiveWindowProp: Add, Checkbox, % "xp+" . height . " yp wp vAWPBordless" . A_Index . " gAWPClick", Borderless
		GuiControl, ActiveWindowProp: Enable, AWPBordless
		}
	}

Gui, ActiveWindowProp: Font


gui, ActiveWindowProp: show, % "hide x" . height "w" . 2.5*height, Active Window Properties

WinMover(hWndActiveWindowProp, "d r")

gui, ActiveWindowProp: show
;WinWaitClose, ahk_id %hWndActiveWindowProp%
return

AWPPrgPriorityChk:
;prgPID
return

AWPClick:
Gui, ActiveWindowProp: Submit, Nohide

clickedindex := 0
	loop % windowHandlesNo
	{
		if (InStr(A_GuiControl, windowHandlesNo - A_Index + 1))
		{
		clickedindex := windowHandlesNo - A_Index + 1
		break
		}
	}
hWnd := PrgLnchOpt.GetTestWindowHandles(selPrgChoice, clickedindex)
GuiControlGet, temp, ActiveWindowProp: , % A_GuiControl

	if (InStr(A_GuiControl, "PrgMinMax"))
	{
	WinGet, fTemp, MinMax , % "ahk_id" . PrgLnchOpt.GetTestWindowHandles(selPrgChoice, clickedindex)
	; make it consistent with the switch statement below
		if (fTemp == -1 )
		fTemp := 0
		else
		{
			if (!fTemp)
			fTemp := -1
		}

	lTemp := temp

	; What if user max/min/restores it?
		if (fTemp == -1 )
		{
			if (temp)
			{
			temp := 0
			}
		}

		else
		{
			if (fTemp)
			{
				if (temp != -1)
				{
				temp := -1
				}
			}
			else
			{
				if (temp != 1)
				{
				temp := 1
				}
			}

		}



		if (lTemp != temp)
		GuiControl, ActiveWindowProp:, % "AWPPrgMinMax" . clickedindex, %temp%


		; assume the prg is launched as 
		switch (temp)
		{
		case -1:
		WinRestore, ahk_id %hWnd%
		case 0:
		WinMinimize, ahk_id %hWnd%
		case 1:
		{
		WinMaximize, ahk_id %hWnd%
		sleep 20
			if (PrgLnchOpt.GetPrgMonToRn(selPrgChoice) == Prglnch.Monitor)
			WinActivate, % "ahk_id" PrgLnch.Hwnd()
		;WinActivate, ahk_id %hWndActiveWindowProp%
		}
		}
	}
	else
	{
		if (!InStr(A_GuiControl, "Bordless"))
		return ; just in case
	BordlessProc(0, selPrgChoice, clickedindex, hWnd)
	}	


;PrgLnchOpt.GetPrgMinMax(selPrgChoice, clickedindex)
;PrgLnchOpt.GetPrgWindowStyles(selPrgChoice, clickedindex)
return

AWPQuit:
ActiveWindowPropGuiClose:
ActiveWindowPropGuiEscape:
gui, ActiveWindowProp: Destroy
Gui, PrgLnch: -Disabled
WinActivate, % "ahk_id" PrgLnch.Hwnd()
return 0
}

