Nice! Still, I suggest a few improvements:
- There is no need for using A_Index to determine if some text is visible, we can still move it
- It is more general to test if the last block of text has scrolled up fully, end exit then
- There seem to be no reason for the GroupBox being there
- The ScrollUp subroutine is called only once, so we can just copy it to the right place
- Wait a second before exit, so the user can read the last line
- shell32.dll should be found via the Path, no need to fully specify its location.
The version below is more general, you can freely edit the main block of text, it will be shown correctly. In the beginning you can set the height of the GUI window and the gaps between the 4 main blocks of information. If you need fewer or more, you have to edit the script in a straightforward way.
Code:
WinH = 99 ; Height of GUI
YPos1 := WinH - 10 ; Bottom of GUI Window
YPos2 := YPos1 + 60 ; 60 pixels gap
YPos3 := YPos2 + 60
YPos4 := YPos3 + 70
TestText =
(LTrim
Producer:`t`tMom`n
AssistantProducer:`tDad`n
Sound:`t`t`tBaby`n
This will go on for a while.
Believe me.
It's not worth reading on.
C'mon - quit now.
Close the gui`n
Hello?`n`n
It's useless reading on.`n`n
Oh look how nice it scrolls
So you wanted it.
I'll close the gui for you.`n`n`n`n
BYE
)
Gui +ToolWindow +AlwaysOnTop
Gui Margin, 0, 0
Gui Add, Picture, vIcon1 x12 y%YPos1% h16 w16 Icon44, shell32.dll
Gui Add, Text, vText1 x30, Chris
Gui Add, Picture, vIcon2 x12 y%YPos2% h16 w16 Icon13, shell32.dll
Gui Add, Text, vText2 x30, John Doe
Gui Add, Picture, vIcon3 x12 y%YPos3% h16 w16 Icon95, shell32.dll
Gui Add, Text, vText3 x30, Jane Doe
Gui Add, Text, vText4 x5 y%YPos1%, %TestText%
Gui Show, w189 h%WinH%, Credits:
Loop
{
YPos1--
GuiControl Move, Icon1, y%YPos1%
GuiControl Move, Text1, y%YPos1%
YPos2--
GuiControl Move, Icon2, y%YPos2%
GuiControl Move, Text2, y%YPos2%
YPos3--
GuiControl Move, Icon3, y%YPos3%
GuiControl Move, Text3, y%YPos3%
YPos4--
GuiControl Move, Text4, y%YPos4%
GuiControlGet Text4, Pos
If (text4Y + text4H < WinH)
Break
Sleep 50
}
Sleep 1000
GuiEscape:
GuiClose:
ExitApp