I am running into an issue with my script showing my second GUI. Both GUIs are meant to replicate a simple MsgBox and prevent users from continuing until they have selected "OK" or something similar.
Note: I use GUIs instead of MsgBoxes simply because I can center the GUI on the active window more easily, which is necessary since my team at work uses multiple monitors/displays.
The first GUI window works perfectly, but when my script attempts to Show the second GUI window, I get a blank window popup that can only be exited if the AHK file is exited.
Until I can get the second one to work, I will resort to just using the first, but having that second window is very helpful for my team at work since we process so many requests (as a support office). Any help is greatly appreciated!
Here is my code as well:
Code: Select all
Gui1:
Gui 1:New,, Loading...
Gui 1:+AlwaysOnTop +ToolWindow -Caption +Border
Gui 1:Color, White
Gui 1:Font, s11, Segoe UI
Gui 1:Add, Text,, % "Continue after page loads!"
Gui 1:Add, Text ; spacer
Gui 1:Add, Button, Default w80 gOK, OK
return
Gui2:
Gui 2:New,, Professional Counseling
Gui 2:Default
Gui 2:+AlwaysOnTop +ToolWindow -Caption +Border
Gui 2:Color, White
Gui 2:Font, s11, Segoe UI
Gui 2:Add, Text,, % "If COEX-MA-D, Select 50+ sections only!"
Gui 2:Add, Text ; spacer
Gui 2:Add, Button, Default w80 gTYBRO, Thanks Bro!
return
OK:
{
Gui 1:Cancel
sleep 50
If (CourseSub = "COUN")
gosub, COUN
else
gosub, SearchAndSelect
}
return
TYBRO:
{
Gui 2:Cancel
}
return
GuiClose:
2GuiClose:
; ----------------------------------------------------------------- ;
SmartReg:
#IfWinActive, Manual Registration
`::
Send, {Shift down}{Home}{Shift up}
sleep 20
Send, ^c
sleep 20
ClipWait
RegClip := Clipboard
{
CourseSub := SubStr(RegClip, 1, 4)
CourseNum := SubStr(RegClip, 6, 3)
CourseSec := SubStr(RegClip, 10, 1)
}
sleep 200
Send ^{pgdn}
sleep 100
Send {F6}
sleep 300
Send {F9}
sleep 300
WinGetPos mX, mY, mW, mH, Application Navigator
Gui 1:Show, % "x" mX+(mW/2)-100 " y" mY+(mH/2)-50 " w225 h125", Loading...
return
SearchAndSelect:
{
Loop, 2
{
Send {tab}
sleep 50
}
SendInput 1%CourseSec%
sleep 75
Loop, 2
{
Send {tab}
sleep 50
}
SendInput %CourseSub%
sleep 75
Loop, 2
{
Send {tab}
sleep 50
}
SendInput %CourseNum%
sleep 75
Loop, 4
{
Send {tab}
sleep 50
}
Send {down}
sleep 75
SendInput >0
sleep 175
Send {F8}
sleep 150
Send !s
sleep 150
Send {Esc}
}
return
COUN:
{
Loop, 2
{
Send {tab}
sleep 50
}
SendInput 1%CourseSec%
sleep 75
Loop, 2
{
Send {tab}
sleep 50
}
SendInput %CourseSub%
sleep 75
Loop, 2
{
Send {tab}
sleep 50
}
SendInput %CourseNum%
sleep 75
Loop, 4
{
Send {tab}
sleep 50
}
Send {down}
sleep 75
SendInput >0
sleep 175
Send {F8}
sleep 50
Gui 2:Show, % "x" mX+(mW/2)-100 " y" mY+(mH/2)-50 " w225 h125", Professional Counseling
}
return