[Function] - MsgBox() - Show simple texts and keep script execution!

Post your working scripts, libraries and tools for AHK v1.1 and older
User
Posts: 407
Joined: 26 Jun 2017, 08:12

[Function] - MsgBox() - Show simple texts and keep script execution!

11 Jan 2019, 23:16

Wrote this just for fun! Show simple texts without pausing the script! (Since I put little to no effort on this, it may contain bugs!)

95_ z_ image.gif
95_ z_ image.gif (1.02 MiB) Viewed 849 times

Code: Select all

loop, 3
MsgBox("Press ''F12'' to create more!")

MsgBox("Press ''F12'' to create more!", "New Title")

msgbox, press ok to exit
exitapp

F12::	;_____________________

MsgBox("Press ''F12'' to create more!")

return





MsgBox(Mgs, Title := "")	;_________________ v1.0 ______________
{

Static Counter := []

	loop
	{
		if (Counter[a_index] == "")
		{
		Counter[a_index] := "Now_In_Use"

		Gui_ID := a_index

		break
		}
	}


gui, % "MsgBox_Function_Gui_" Gui_ID ":Default"

Gui, +HwndTemp_Win_Id +LabelMsgBox_Function_Gui

gui, add, text, +HwndTemp_Control_Id, % Mgs == "" ?  "Hello" : Mgs

ControlGetPos , Ctrl_X, Ctrl_Y, Ctrl_W, Ctrl_H, , % "ahk_id" Temp_Control_Id

	if (Ctrl_W < 300)
	{
	Win_W := 300

	ControlMove, , % Win_W/2 - Ctrl_W/2, , , , % "ahk_id" Temp_Control_Id

		;WinMove, % "ahk_id" Temp_Control_Id, , % Win_W/2 - Ctrl_W/2
	}

	if (Ctrl_H < 100)
	{
	Win_H := 100

		;ControlMove, , , % Win_H/2 - Ctrl_H/2, , , % "ahk_id" Temp_Control_Id

		;"ControlMove" does not center control correctly  

	WinMove, % "ahk_id" Temp_Control_Id, , , % Win_H/2 - Ctrl_H/2
	}

gui, show, % "w" Win_W " h" Win_H, % Title == "" ? "MsgBox_Function_Gui_" Gui_ID : Title

return

MsgBox_Function_GuiClose:	;___

gui, destroy

Counter[RegExReplace(a_gui, "\D")] := ""

return

}

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Theda and 157 guests