Will GUI crash if i add too many elements?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
lVlrBoJang1es
Posts: 7
Joined: 20 Aug 2018, 08:36

Will GUI crash if i add too many elements?

11 Oct 2018, 15:02

I'm reusing some of my old GUI code which contains a function for scrolling status messages.

In its original use, the scrolling message was only looped 10-100 times by the user before the program was ended. In its new implementation, it will be running on a machine interface that operates nearly 24/7, 365.

My method of achieving the "scrolling" look is to shift the status messages down as a new message arrives, while slowly decreasing the height of the last message. If i understand correctly, these shrunken text elements still exist, they just have a height of 0.

My question is; if i let these messages scroll for days on end, will i run into a memory problem? Mentally i'm telling myself that there will be an endless pile of (invisible) text elements at the bottom of my status window with a height of 0. At some point this number will accumulate so large that the program will crash. If not, i'll surely run into a problem when Static1 accumulates into Static9223372036854775807 (0x7FFFFFFFFFFFFFFF).

I saw in the help file that GuiControl, Delete is not implemented yet. My other though was to "re-use" each of the oldest text elements as the newest element rather than creating a new one. As a last resort, i could destroy the GUI on a timer and re-create it every so often (i'd rather not do this).

The code attached below is a raw form of my GUI from my "play area" - it's REALLY messy and contains a bunch of fluff that isn't used here but is in my original program., sorry. It should illustrate my point though... Do a Ctrl+F on "Height6" to see the area where i'm shrinking the height to make the last message "disappear".

Press Ctrl+Alt+1,2,3 to see the messages and how they scroll.

Any thoughts?


Code: Select all

#Persistent																													;(* Keep script running								*)
#NoEnv																														;(*	Handle empty variables							*)
SetBatchLines -1																											;(* Run script at max speed							*)
ListLines Off																												;(*	Only show most recent executed lines in history	*)
DetectHiddenText, 	ON																										;(* Hidden text omitted from search criteria		*)

if(!(iStringCnt >= 0))																									
	iStringCnt			:= 5																					
if(!(iPrintStringIndex >= 0))																							
	iPrintStringIndex	:= 0																							
if(!(iPrintStringCnt >= 0))																								
	iPrintStringCnt		:= 0																								

;Gui, New, +AlwaysOnTop -Caption, Collation Helper
Gui  +AlwaysOnTop -Caption
;(* Program Status Header *)
Gui +LastFound
Gui, Font, S20       C0099CC W700, Verdana
Gui, Add,  Text,     x5   y0   w236  h32, Program Status
;(* Status Window Texts *)
Gui, Font, S12       CD2D2D2 W400, Verdana
Gui, Add,  Text,     x10   y35  w113  h18, Label Printing
Gui, Add,  Text,     x230  y35 w150  h20, Data Gathering
;(* Status Window Group Boxes *)
Gui, Add,  GroupBox, x10  y45  w200  h85, 
Gui, Add,  GroupBox, x230 y45  w200  h85,
;(* Window divider *)
Gui, Add,  GroupBox, x-2 y-11 w454 h161

;(* Machine Status *)
Gui, Font, S20       C0099CC W700, Verdana
Gui, Add,  Text,     x5   y150   w236  h32, Machine Status

Gui, Font, S18       C222226 W400, Verdana
Gui, Add, Text, x125 y240 w200 h32, Coming soon...


;Gui, Font, S8       C6E6E78 W400, Verdana
;Gui, Add, Text, x15 y56 w190 h13, testg

;Gui, Font, S12 C0099CC W100, Wingdings
;Gui, Add, Text, x15 y150 w190 h13, pon

;Gui, Add,  GroupBox, x-2  y-11  w243  h300

Gui, Color, 0x000000
;Gui, Add, Text, x0 y0 w230 h14, test123																;(*	   Add newest message at first position			*)
Gui, Show, w440 h375, Collation Helper
return

GuiClose:
ExitApp


;(* Shift window up *)
^!Up::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,, Y-5
	return
;(* Shift window down *)
^!Down::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,, Y+5 
	return
;(* Shift window right *)
^!Left::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,X-5,
	return
;(* Shift window left *)
^!Right::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,X+5,
	return
^!1::
	sPrintStatus := "Waiting for start of next spool..."
	iPrintStatusID := 1
	UpdatePrintStatus()
	return
^!2::
	sPrintStatus := "Message 2"
	iPrintStatusID := 2
	UpdatePrintStatus()
	return
^!3::
	sPrintStatus := "Message 3"
	iPrintStatusID := 3
	UpdatePrintStatus()
	return


;(*	Update Turck Status Messages ---------------------------------------------------------------------------------------------------------------------------------------------- *)
UpdatePrintStatus()																											;(* Update GUI status message function				*)
{																															;(*													*)
	Global sPrintStatus																										;(* Pull first status message as global				*)
	Global sPrintStatus2																									;(* Pull second status message as global			*)
	Global sPrintStatus3																									;(* Pull third status message as global				*)
	Global sPrintStatus4																									;(* Pull third status message as global				*)
	Global sPrintStatus5																									;(* Pull third status message as global				*)
	Global iPrintStatusID																									;(* Pull status ID as global						*)
	Global iPrintStatusID2																									;(* Pull previous status ID as global				*)
	Global iStringCnt																										;(* Pull string total count as global				*)
	Global iPrintStringIndex																								;(* Pull Turck string index as global				*)
	Global iPrintStringCnt																									;(* Pill Turck string count as global				*)
	Global iPrintStringIndex2																								;(* Pull Turck 2nd string index as global			*)
	global iPrintStringIndex3																								;(* Pull Turck 3rd string index as global			*)
	global iPrintStringIndex4																								;(* Pull Turck 3rd string index as global			*)
	global iPrintStringIndex5																								;(* Pull Turck 3rd string index as global			*)
	if(iPrintStringIndex = 0)																								;(* Turck string index = 0?							*)
	{																														;(*													*)
		if(iStringCnt > 0)																									;(*  Total string count > 0?						*)
			iPrintStringIndex := iStringCnt																					;(*   Set Turck string index = total string count	*)
	}																														;(*													*)
	if(TRUE)																												;(*	 Is the Turck update still required?			*)
	{																														;(*													*)
		if(iPrintStatusID != iPrintStatusID2)																				;(*   Has the status ID changed from the previous?	*)
		{																													;(*													*)
			;(* Shift GUI status messages down to make room for newest message ------------------------------------------------------------------------------------------------ *)
			Loop, 14																										;(*	   Loop for 14 iterations						*)
			{																												;(*													*)
				if (iPrintStringCnt >= 2)																					;(*		Two or more pre-existing status messages?	*)
				{																											;(*													*)
					iYCoord3 := (69 + A_Index)																				;(*		 Increase message 3 Y coord. by loop index	*)
					sYCoord3 := % "y" . iYCoord3																			;(*		 Assemble message 3 Y coord. string			*)
					GuiControl, Move, % "Static" iPrintStringIndex2, x15, %sYcoord3%										;(*		 Move 3rd message to new Y coord			*)
				}																											;(*													*)
				if (iPrintStringCnt >= 3)																					;(*		Two or more pre-existing status messages?	*)
				{																											;(*													*)
					iYCoord4 := (84 + A_Index)																				;(*		 Increase message 3 Y coord. by loop index	*)
					sYCoord4 := % "y" . iYCoord4																			;(*		 Assemble message 3 Y coord. string			*)
					GuiControl, Move, % "Static" iPrintStringIndex3, x15, %sYcoord4%										;(*		 Move 3rd message to new Y coord			*)
				}																											;(*													*)
				if (iPrintStringCnt >= 4)																					;(*		Two or more pre-existing status messages?	*)
				{																											;(*													*)
					iYCoord5 := (99 + A_Index)																				;(*		 Increase message 3 Y coord. by loop index	*)
					sYCoord5 := % "y" . iYCoord5																			;(*		 Assemble message 3 Y coord. string			*)
					GuiControl, Move, % "Static" iPrintStringIndex4, x15, %sYcoord5%										;(*		 Move 3rd message to new Y coord			*)
				}																											;(*													*)
				if (iPrintStringCnt >= 5)																					;(*		Three or more pre-existing status messages?	*)
				{																											;(*													*)
					iYCoord6 := (114 + A_Index)																				;(*		 Increase message 4 Y coord. by loop index	*)
					sYCoord6 := % "y" . iYCoord6																			;(*		 Assemble message 4 Y coord. string			*)
					sHeight6 := % "h" . (14 - A_Index)																		;(*		 Decrease message 4 height					*)
					GuiControl, Move, % "Static" iPrintStringIndex5, x15, %sHeight6%, %sYcoord6%							;(*		 Move 4th message to new Y coord.			*)
				}																											;(*													*)
				if(iPrintStringCnt >= 1)																					;(*	   One or more pre-existing status messages?	*)
				{																											;(*													*)
					iYCoord2 := (55 + A_Index)																				;(*		Increase message 2 Y coord. by loop index	*)
					sYCoord2 := % "y" . iYCoord2																			;(*		Assemble message 2 Y coord. string			*)
					GuiControl, Move, % "Static" iPrintStringIndex, x15, %sYcoord2%											;(*		Move 2nd message to new Y coord.			*)
				}																											;(*													*)
				Sleep, 1																									;(*		Sleep 1ms so shift isn't instantaneous		*)
			}																												;(*													*)
			if(iPrintStringCnt >= 1)																						;(*	   One or more pre-existing status messages?	*)
			{							
				Gui, Font, S8       C6E6E78 W400, Verdana
				GuiControl, Font, % "Static" iPrintStringIndex
			}
			if(iPrintStringCnt >= 2)																						;(*	   One or more pre-existing status messages?	*)
			{							
				Gui, Font, S8       C505058 W400, Verdana
				GuiControl, Font, % "Static" iPrintStringIndex2
			}
			if(iPrintStringCnt >= 3)																						;(*	   One or more pre-existing status messages?	*)
			{							
				Gui, Font, S8       C37373D W400, Verdana
				GuiControl, Font, % "Static" iPrintStringIndex3
			}
			if(iPrintStringCnt >= 4)																						;(*	   One or more pre-existing status messages?	*)
			{							
				Gui, Font, S8       C222226 W400, Verdana
				GuiControl, Font, % "Static" iPrintStringIndex4
			}
			if(iPrintStringCnt >=5)
				GuiControl, Hide, % "Static" iPrintStringIndex5
			;(* --------------------------------------------------------------------------------------------------------------------------------------------------------------- *)
			Gui, Font, S8       C0099CC W400, Verdana
			Gui, Add, Text, x15 y56 w190 h13, %sPrintStatus%
			;(* Re Index existing messages for next function call ------------------------------------------------------------------------------------------------------------- *)
			sPrintStatus5		:= 	sPrintStatus4																			;(*	   Copy 2nd string to 3rd string				*)
			sPrintStatus4		:= 	sPrintStatus3																			;(*	   Copy 2nd string to 3rd string				*)
			sPrintStatus3		:= 	sPrintStatus2																			;(*	   Copy 2nd string to 3rd string				*)
			sPrintStatus2		:= 	sPrintStatus																			;(*	   Copy 1st string into 2nd string				*)
			iPrintStatusID2 	:= 	iPrintStatusID																			;(*	   Copy current string ID to previous string ID	*)
			iPrintStringIndex5	:=	iPrintStringIndex4																		;(*	   Copy Turck index 2 to index 3				*)
			iPrintStringIndex4	:=	iPrintStringIndex3																		;(*	   Copy Turck index 2 to index 3				*)
			iPrintStringIndex3	:=	iPrintStringIndex2																		;(*	   Copy Turck index 2 to index 3				*)
			iPrintStringIndex2	:=	iPrintStringIndex																		;(*	   Copy Turck index 1 to index 2				*)
			iStringCnt 			+= 	1																						;(*	   Increase total string count					*)
			iPrintStringIndex 	:= iStringCnt																				;(*    Copy total string count to Turck index 1		*)
			iPrintStringCnt		+= 	1																						;(*	   INcrease turck string count					*)
			;(* --------------------------------------------------------------------------------------------------------------------------------------------------------------- *)
		}																													;(*													*)
	}																														;(*													*)
	return																													;(*  Return to program								*)
}																															;(*													*)
User avatar
mshall
Posts: 35
Joined: 13 Jul 2018, 16:42
Contact:

Re: Will GUI crash if i add too many elements?

11 Oct 2018, 16:35

Yes, it will eventually crash. I have a bingo game that you click a picture and it adds a token. After some testing, stacking about 1000 pictures caused it to crash. Not sure if there is a hard cap or some other way to avoid it. It luckily isn't a problem in my application.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Will GUI crash if i add too many elements?

11 Oct 2018, 17:17

Give this a try it has same functionality but only uses 5 text controls and simplified.

Code: Select all

#Persistent																													;(* Keep script running								*)
#NoEnv																														;(*	Handle empty variables							*)
SetBatchLines -1																											;(* Run script at max speed							*)
ListLines Off																												;(*	Only show most recent executed lines in history	*)
DetectHiddenText, 	ON																										;(* Hidden text omitted from search criteria		*)

if(!(iStringCnt >= 0))																									
	iStringCnt			:= 5																					
if(!(iPrintStringIndex >= 0))																							
	iPrintStringIndex	:= 0																							
if(!(iPrintStringCnt >= 0))																								
	iPrintStringCnt		:= 0																								

;Gui, New, +AlwaysOnTop -Caption, Collation Helper
Gui  +AlwaysOnTop -Caption
;(* Program Status Header *)
Gui +LastFound
Gui, Font, S20       C0099CC W700, Verdana
Gui, Add,  Text,     x5   y0   w236  h32, Program Status
;(* Status Window Texts *)
Gui, Font, S12       CD2D2D2 W400, Verdana
Gui, Add,  Text,     x10   y35  w113  h18, Label Printing
Gui, Add,  Text,     x230  y35 w150  h20, Data Gathering
;(* Status Window Group Boxes *)
Gui, Add,  GroupBox, x10  y45  w200  h85, 
Gui, Add,  GroupBox, x230 y45  w200  h85,
;(* Window divider *)
Gui, Add,  GroupBox, x-2 y-11 w454 h161

;(* Machine Status *)
Gui, Font, S20       C0099CC W700, Verdana
Gui, Add,  Text,     x5   y150   w236  h32, Machine Status

Gui, Font, S18       C222226 W400, Verdana
Gui, Add, Text, x125 y240 w200 h32, Coming soon...


;Gui, Font, S8       C6E6E78 W400, Verdana
;Gui, Add, Text, x15 y56 w190 h13, testg

;Gui, Font, S12 C0099CC W100, Wingdings
;Gui, Add, Text, x15 y150 w190 h13, pon

;Gui, Add,  GroupBox, x-2  y-11  w243  h300

Gui, Color, 0x000000
;~ Gui, Add, Text, x0 y0 w230 h14, test123																;(*	   Add newest message at first position			*)
Gui, Show, w440 h375, Collation Helper
return

GuiClose:
ExitApp


;(* Shift window up *)
^!Up::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,, Y-5
	return
;(* Shift window down *)
^!Down::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,, Y+5 
	return
;(* Shift window right *)
^!Left::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,X-5,
	return
;(* Shift window left *)
^!Right::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,X+5,
	return
^!1::
	sPrintStatus := "Waiting for start of next spool..."
	iPrintStatusID := 1
	UpdatePrintStatus(sPrintStatus)
	return
^!2::
	sPrintStatus := "Message 2"
	iPrintStatusID := 2
	UpdatePrintStatus(sPrintStatus)
	return
^!3::
	sPrintStatus := "Message 3"
	iPrintStatusID := 3
	UpdatePrintStatus(sPrintStatus)
	return

UpdatePrintStatus(sPrintStatus)
{
	static isTextControls := 0 , txt1, txt2, txt3, txt4, txt5
	; Create text controls and set 1st row status on 1st usage:
	if !isTextControls
	{
		isTextControls := 1
		Gui, Font, S8       C0099CC W400, Verdana
	    Gui, Add, Text, x15 y56 w190 h13 vtxt1, % sPrintStatus
		Gui, Font, S8       C505058 W400, Verdana
		Gui, Add, Text, x15 y69 w190 h13 vtxt2,
		Gui, Add, Text, x15 y82 w190 h13 vtxt3,
		Gui, Add, Text, x15 y95 w190 h13 vtxt4,
		Gui, Add, Text, x15 y108 w190 h13 vtxt5,
	}
	else
	{
	    ; Get text from controls 1-4 (5 is discarded)
		Gui, Submit, NoHide
	    GuiControlGet, t1,, txt1
	    GuiControlGet, t2,, txt2
	    GuiControlGet, t3,, txt3
		GuiControlGet, t4,, txt4
		; Place new status at top and push others down
		GuiControl,, txt1, % sPrintStatus
		GuiControl,, txt2, % t1
		GuiControl,, txt3, % t2
		GuiControl,, txt4, % t3
		GuiControl,, txt5, % t4
	}
}
HTH
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Will GUI crash if i add too many elements?

11 Oct 2018, 22:43

In my experience, creating too many windows will cause issues for the whole session before it "crashes" the script. The same goes for creating too many windows across multiple processes. For instance, I once opened over 120 scientific calculator windows on Windows XP, and task manager started to act very strange, with parts of its interface disappearing and reappearing. The scientific calculator in XP has a whole lot of buttons, and each button is a child window/control. (However, the Windows 10 calculator doesn't have any controls.)

AutoHotkey is designed to allow tens of thousands of controls, but you should never create anywhere near that many.
lVlrBoJang1es
Posts: 7
Joined: 20 Aug 2018, 08:36

Re: Will GUI crash if i add too many elements?

16 Oct 2018, 08:07

I rewrote the status message portion of my program to re-use the last status message text element.

Once the message is shifted from the 5th position to "off-screen", it is then re-assigned a text message and bumped back to the first first message position.

Thanks for the help guys!

Code: Select all

#Persistent																													;(* Keep script running								*)
#NoEnv																														;(*	Handle empty variables							*)
SetBatchLines -1																											;(* Run script at max speed							*)
ListLines Off																												;(*	Only show most recent executed lines in history	*)
DetectHiddenText, 	ON																										;(* Hidden text omitted from search criteria		*)

if(!(iStringCnt >= 0))																									
	iStringCnt			:= 5																					

if(!(iPrintStringIndex >= 0))																							
	iPrintStringIndex	:= 0																							
if(!(iPrintStringCnt >= 0))																								
	iPrintStringCnt		:= 0

iPrintStringIndex := iStringCnt

if(!(iDataStringIndex >= 0))																							
	iDataStringIndex	:= 0																							
if(!(iDataStringCnt >= 0))																								
	iDataStringCnt		:= 0

aiPrintIndexArray := []

bOnePass := FALSE

;Gui, New, +AlwaysOnTop -Caption, Collation Helper
Gui  +AlwaysOnTop -Caption
;(* Program Status Header *)
Gui +LastFound
Gui, Font, S20       C0099CC W700, Verdana
Gui, Add,  Text,     x5   y0   w236  h32, Program Status
;(* Status Window Texts *)
Gui, Font, S12       CD2D2D2 W400, Verdana
Gui, Add,  Text,     x10   y35  w113  h18, Label Printing
Gui, Add,  Text,     x230  y35 w150  h20, Data Gathering
;(* Status Window Group Boxes *)
Gui, Add,  GroupBox, x10  y45  w200  h85, 
Gui, Add,  GroupBox, x230 y45  w200  h85,
;(* Window divider *)
Gui, Add,  GroupBox, x-2 y-11 w454 h161

;(* Machine Status *)
Gui, Font, S20       C0099CC W700, Verdana
Gui, Add,  Text,     x5   y150   w236  h32, Machine Status

Gui, Font, S18       C222226 W400, Verdana
Gui, Add, Text, x125 y240 w200 h32, Coming soon...


;Gui, Font, S8       C6E6E78 W400, Verdana
;Gui, Add, Text, x15 y56 w190 h13, testg

;Gui, Font, S12 C0099CC W100, Wingdings
;Gui, Add, Text, x15 y150 w190 h13, pon

;Gui, Add,  GroupBox, x-2  y-11  w243  h300

Gui, Color, 0x000000
;Gui, Add, Text, x0 y0 w230 h14, test123																;(*	   Add newest message at first position			*)
Gui, Show, w440 h375, Collation Helper
return

GuiClose:
ExitApp


;(* Shift window up *)
^!Up::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,, Y-5
	return
;(* Shift window down *)
^!Down::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,, Y+5 
	return
;(* Shift window right *)
^!Left::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,X-5,
	return
;(* Shift window left *)
^!Right::
	WinGetPos, X, Y, , , Collation Helper
	WinMove, Collation Helper,,X+5,
	return
	
;(* Print Messages *)
^!1::
	sPrintStatus := "Print Message 1"
	iPrintStatusID := 1
	UpdatePrintStatus()
	return
^!2::
	sPrintStatus := "Print Message 2"
	iPrintStatusID := 2
	UpdatePrintStatus()
	return
^!3::
	sPrintStatus := "Print Message 3"
	iPrintStatusID := 3
	UpdatePrintStatus()
	return
^!4::
	sPrintStatus := "Print Message 4"
	iPrintStatusID := 4
	UpdatePrintStatus()
	return
^!5::
	sPrintStatus := "Print Message 5"
	iPrintStatusID := 5
	UpdatePrintStatus()
	return
^!6::
	sPrintStatus := "Print Message 6"
	iPrintStatusID := 6
	UpdatePrintStatus()
	return
	
;(*	Update Turck Status Messages ---------------------------------------------------------------------------------------------------------------------------------------------- *)
UpdatePrintStatus()																											;(* Update GUI status message function				*)
{																															;(*													*)
	Global sPrintStatus																										;(* Pull first status message as global				*)
	Global iPrintStatusID																									;(* Pull status ID as global						*)
	Global iPrintStatusID2																									;(* Pull previous status ID as global				*)
	Global iStringCnt																										;(* Pull string total count as global				*)
	Global iPrintStringCnt																									;(* Pill Turck string count as global				*)
	Global iPrintStringIndex																								;(* Pull Turck string index as global				*)
	Global iPrintStringIndex2																								;(* Pull Turck 2nd string index as global			*)
	global iPrintStringIndex3																								;(* Pull Turck 3rd string index as global			*)
	global iPrintStringIndex4																								;(* Pull Turck 3rd string index as global			*)
	global iPrintStringIndex5																								;(* Pull Turck 3rd string index as global			*)
	global iPrintStringIndex6																								;(* Pull Turck 3rd string index as global			*)
	global iPrintIndex
	global aiPrintIndexArray
	global iIndexArrayLength
	
	if(iPrintStatusID != iPrintStatusID2)																					;(*   Has the status ID changed from the previous?	*)
	{																														;(*													*)	

		;(* Create element index and color fades - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*)
		IF(iPrintStringCnt >= 1)
		{
			iIndexArrayLength := aiPrintIndexArray.Length()
			
			iElementIndex2	  := aiPrintIndexArray[iIndexArrayLength]
			Gui, Font, S8       C6E6E78 W400, Verdana
			GuiControl, Font, % "Static" iElementIndex2
			
			If(iPrintStringCnt >= 2)
			{
				iElementIndex3	  := aiPrintIndexArray[iIndexArrayLength-1]
				Gui, Font, S8       C505058 W400, Verdana
				GuiControl, Font, % "Static" iElementIndex3
				
				If(iPrintStringCnt >= 3)
				{
					iElementIndex4	  := aiPrintIndexArray[iIndexArrayLength-2]
					Gui, Font, S8       C37373D W400, Verdana
					GuiControl, Font, % "Static" iElementIndex4
					
					If(iPrintStringCnt >= 4)
					{
						iElementIndex5	  := aiPrintIndexArray[iIndexArrayLength-3]
						Gui, Font, S8       C222226 W400, Verdana
						GuiControl, Font, % "Static" iElementIndex5
							
						If(iPrintStringCnt >= 5)
							iElementIndex6	  := aiPrintIndexArray[iIndexArrayLength-4]
					}
				}
			}
			;(* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*)
			Loop, 14
			{	
				If(iPrintStringCnt >= 2)
				{
					If(iPrintStringCnt >= 3)
					{
						IF(iPrintStringCnt >= 4)
						{
							If(iPrintStringCnt >= 5)
							{
								;(* Move message from row 5 to off screen*
								iYCoord6 	 := (114 + A_Index)																				;(*		 Increase message 4 Y coord. by loop index	*)
								sYCoord6 	 := % "y" . iYCoord6																			;(*		 Assemble message 4 Y coord. string			*)
								sHeight6 	 := % "h" . (14 - A_Index)																		;(*		 Decrease message 4 height					*)
								GuiControl, Move, % "Static" iElementIndex6, x15, %sHeight6%, %sYcoord6%							;(*		 Move 4th message to new Y coord.			*)
							}

							;(* Move message from row 4 to 5 *)
							iYCoord5 := (99 + A_Index)																				;(*		 Increase message 3 Y coord. by loop index	*)
							sYCoord5 := % "y" . iYCoord5																			;(*		 Assemble message 3 Y coord. string			*)
							GuiControl, Move, % "Static" iElementIndex5, x15, %sYcoord5%										;(*		 Move 3rd message to new Y coord			*)
						}
						
						;(* Move message from row 3 to 4 *)
						iYCoord4 := (84 + A_Index)																				;(*		 Increase message 3 Y coord. by loop index	*)
						sYCoord4 := % "y" . iYCoord4																			;(*		 Assemble message 3 Y coord. string			*)
						GuiControl, Move, % "Static" iElementIndex4, x15, %sYcoord4%										;(*		 Move 3rd message to new Y coord			*)
					}
					
					;(* Move message from row 2 to 3 *)
					iYCoord3 := (69 + A_Index)																				;(*		 Increase message 3 Y coord. by loop index	*)
					sYCoord3 := % "y" . iYCoord3																			;(*		 Assemble message 3 Y coord. string			*)
					GuiControl, Move, % "Static" iElementIndex3, x15, %sYcoord3%										;(*		 Move 3rd message to new Y coord			*)
				}
				
				;(* Move message from row 1 to 2 *)
				iYCoord2 := (55 + A_Index)																				;(*		Increase message 2 Y coord. by loop index	*)
				sYCoord2 := % "y" . iYCoord2																			;(*		Assemble message 2 Y coord. string			*)
				GuiControl, Move, % "Static" iElementIndex2, x15, %sYcoord2%											;(*		Move 2nd message to new Y coord.			*)
				
				sleep, 1
			}
		}
		
		;(* Add latest string to top of stack *)
		IF(iPrintStringCnt <= 4)
		{
			Gui, Font, S8       C0099CC W400, Verdana
			Gui, Add, Text, x15 y56 w190 h13, %sPrintStatus%
			iPrintStringCnt   += 1
			iPrintStringIndex += 1
			aiPrintIndexArray.Push(iPrintStringIndex)
		}
		else
		{
			iFirstElement := aiPrintIndexArray.RemoveAt(1)
			Gui, Font, S8       C0099CC W400, Verdana
			GuiControl, Font, % "Static" iFirstElement
			GuiControl, Text, % "Static" iFirstElement, %sPrintStatus%
			GuiControl, Move, % "Static" iFirstElement, x15, h13, y56,
			aiPrintIndexArray.Push(iFirstElement)
		}
		iPrintStatusID2 := iPrintStatusID 
	}
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CrowexBR, vysmaty and 262 guests