 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
AGU Guest
|
Posted: Tue Dec 06, 2005 9:03 am Post subject: Credits GUI |
|
|
Don't know if s.th like this has been done before. But here is a credits gui I recently made.
| Code: | YPosIcon1 = 97
YPosIcon2 = 97
YPosIcon3 = 97
YPosIcon4 = 97
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`n`n
BYE
)
If ( A_OSType = "WIN32_WINDOWS" ) ; Windows 9x
DefaultItem = %A_WinDir%\system\shell32.dll
Else
DefaultItem = %A_WinDir%\system32\shell32.dll
Gui +ToolWindow +AlwaysOnTop
Gui, Margin, 0, 0
Gui, Add, Picture, vIcon1 x72 ym+95 h16 w16 Icon44 AltSubmit, %DefaultItem%
Gui, Add, Text, vText1 x90 ym+95 , Chris
Gui, Add, Picture, vIcon2 x72 ym+95 h16 w16 Icon13 AltSubmit, %DefaultItem%
Gui, Add, Text, vText2 x95 ym+95, John Doe
Gui, Add, Picture, vIcon3 x72 ym+95 h16 w16 Icon95 AltSubmit, %DefaultItem%
Gui, Add, Text, vText3 x95 ym+95, Jane Doe
Gui, Add, Text, vText4 x23 ym+95, %TestText%
Gui, Add, GroupBox, xm ym-6 w189 h100
Gui, Show, w189 h93, Credits:
GoSub, ScrollUp
Return
GuiClose:
ExitApp
ScrollUp:
Loop, 264
{
If A_Index <=55
{
YPosIcon1 -= 2
GuiControl, Move, Icon1, x72 y%YPosIcon1%
GuiControl, Move, Text1, x90 y%YPosIcon1%
}
If (A_Index >= 27) AND (A_Index <= 82)
{
YPosIcon2 -= 2
GuiControl, Move, Icon2, x72 y%YPosIcon2%
GuiControl, Move, Text2, x90 y%YPosIcon2%
}
If (A_Index >= 54) AND (A_Index <= 109)
{
YPosIcon3 -= 2
GuiControl, Move, Icon3, x72 y%YPosIcon3%
GuiControl, Move, Text3, x90 y%YPosIcon3%
}
If (A_Index >= 78) AND (A_Index <= 262)
{
YPosIcon4 -= 2
GuiControl, Move, Text4, y%YPosIcon4%
}
If (A_Index = 264)
{
GoSub, GuiClose
}
Sleep, 150
}
Return |
|
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1378 Location: switzerland
|
Posted: Tue Dec 06, 2005 9:33 am Post subject: |
|
|
hello AGU,
didn't realise , how it works, must work on it (when have time)
very nice
I'll close the gui for you  |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4425 Location: Pittsburgh
|
Posted: Tue Dec 06, 2005 6:37 pm Post subject: |
|
|
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
|
|
|
| Back to top |
|
 |
AGU Guest
|
Posted: Tue Dec 06, 2005 8:51 pm Post subject: |
|
|
*sigh* I love optimized code. Thx Laszlo
| Quote: | | There seem to be no reason for the GroupBox being there | Right. It forgot to remove it. I planned to make Gui, -Caption and therefore a little frame might have looked good, but in the end I thought it won't be good to remove the Close Button.
| Code: | ...
If (text4Y + text4H < WinH)
Break
... | Could you give me a hint what you have done here? I can't see that text4Y variable is defined anywhere. Nevertheless it's working and it holds a value.
Tried to study the gui commmand docs but can't find a passage describing the effects of attaching "Y" and "H" to a control name. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4425 Location: Pittsburgh
|
Posted: Tue Dec 06, 2005 8:55 pm Post subject: |
|
|
| GuiControlGet Var, Pos sets 4 variables: VarX, VarY, VarW, VarH |
|
| Back to top |
|
 |
it's cool Guest
|
Posted: Wed Dec 07, 2005 3:47 pm Post subject: |
|
|
| Can you use a txt file to read from for the credits info? |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4425 Location: Pittsburgh
|
Posted: Wed Dec 07, 2005 5:48 pm Post subject: |
|
|
| The TestText variable can be set by ReadFile, IniRead or as you like. The first 3 scrolling lines (not in the TestText) are a bit more involved, because you need to supply the icons. If you don't need those, just delete the corresponding lines from the script. |
|
| Back to top |
|
 |
CreaTOR Guest
|
Posted: Sat Aug 19, 2006 8:20 pm Post subject: Loop Credit |
|
|
Hi together.I have a problem.because i wantd that my credit running in a endless loop.but i dont know how to fix it.please excause me but my english isnt very good *smile* :-)Greetings CreaTOR
here is the code of the credit that have to run in a endless loop:
| Code: | WinH = 529 ; Height of GUI
YPos1 := WinH - 10 ; Bottom of GUI Window
YPos2 := YPos1 + 530 ; 60 pixels gap
Gui +ToolWindow +AlwaysOnTop
Gui Margin, 0, 0
Gui, color, #000000
Gui Add, Picture, vIcon1 x0 y%YPos1% h529 w178 , intro.bmp
Gui Add, Picture, vIcon2 x0 y%YPos2% h529 w178 , intro.bmp
Gui Show, w178 h%WinH%, Credits:
loop,
{
YPos1--
GuiControl Move, Icon1, y%YPos1%
YPos2--
GuiControl Move, Icon2, y%YPos2%
GuiControlGet Icon2, Pos
If (icon2Y + icon2H < WinH)
break
sleep, 5
}
sleep, 1000
GuiEscape:
GuiClose:
ExitApp |
Here is the pic that u need for the script:
http://www.evardnet.ch/horlacher/tools/filez/download.php?dir=/tools/filez/files/oeffentlich/&file=intro.bmp |
|
| Back to top |
|
 |
Rabiator
Joined: 17 Apr 2005 Posts: 281 Location: Sauerland
|
Posted: Sat Aug 19, 2006 9:32 pm Post subject: |
|
|
Change the loop as follows: | Code: | loop,
{
YPos1--
If Ypos1 < -530
YPos1 := WinH - 10
GuiControl Move, Icon1, y%YPos1%
YPos2--
If Ypos2 < -530
YPos2 := WinH - 10
GuiControl Move, Icon2, y%YPos2%
GuiControlGet Icon2, Pos
sleep, 5
} |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|