AutoHotkey Community

It is currently May 27th, 2012, 6:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Credits GUI
PostPosted: December 6th, 2005, 9:03 am 
Don't know if s.th like this has been done before. But here is a credits gui I recently made. :mrgreen:

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2005, 9:33 am 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
hello AGU,
didn't realise , how it works, must work on it (when have time)
very nice
I'll close the gui for you :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2005, 6:37 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2005, 8:51 pm 
*sigh* I love optimized code. :mrgreen: 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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2005, 8:55 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
GuiControlGet Var, Pos sets 4 variables: VarX, VarY, VarW, VarH


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 7th, 2005, 3:47 pm 
Can you use a txt file to read from for the credits info?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 7th, 2005, 5:48 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Loop Credit
PostPosted: August 19th, 2006, 8:20 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2006, 9:32 pm 
Offline

Joined: April 17th, 2005, 7:47 pm
Posts: 289
Location: Sauerland
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
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Google Feedfetcher, JamixZol, rbrtryn, Stigg, Yahoo [Bot] and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group