AutoHotkey Community

It is currently May 26th, 2012, 3:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Credits [function]
PostPosted: April 8th, 2008, 4:46 pm 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
I found a Credits window in Compile_AHK II and in this post Credits Gui. Because I liked it and found it useful I made a function out of it:

To use it, make a Gui and add credits afterwards.

    credits(WinTitel,Yend=0,repeat=1,GuiID=1)

WinTitel: Name of the Credits window
Yend: an Offset for the animation
Repeat: nothing more to say
GuiId: Windows number

Code:
  Gui, Add, Button,     gAbout    ,show Credit
  Gui, Show, y10 w100 h50,Main
Return

about:
  titel= Credits:
  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,55: +ToolWindow +AlwaysOnTop
  Gui,55: Margin, 0, 0
  Gui,55: Add, Picture, vIcon1 x10  h16 w16 Icon44, shell32.dll
  Gui,55: Add, Text,    vText1 yp+0 x30, Chris
  Gui,55: Add, Picture, vIcon  x10  h16 w16 Icon13, shell32.dll
  Gui,55: Add, Text,    vText2 yp+0 x30, TiTan
  Gui,55: Add, Picture, vIcon3 x10  h16 w16 Icon95, shell32.dll
  Gui,55: Add, Text,    vText3 yp+0 x30, Jane Doe
  Gui,55: Add, Text,    vText4 yp+30 x10, %TestText%
  Gui,55: Add, Button,   g55GuiClose      x250,test
  Gui,55: Add, Text,    vText5 yp+0 x10, made by haichen
  Gui,55: Add, Text,    vText6 x10, 2008
  Gui,55: Show,  h255 ,%titel%
  credits(titel,70,1,55)
Return

credits(WinTitel,Yend=0,repeat=1,GuiID=1){
    global
    Gui, Submit, NoHide
    test  := WinExist(WinTitel)
    WinGetPos,,,WinW,WinH,%WinTitel%
    WinGet, ActiveControlList, ControlList,%WinTitel%

    ctr=0
    Loop, Parse, ActiveControlList, `n,%a_Space%
    {
      ctr++
      GuiControlGet GC%a_index%Pos, %GuiID%:Pos,%A_LoopField%
      If (GC%a_index%PosY<>"")and(GC%a_index%PosY>0)
        LastPos := GC%a_index%PosY
      If (A_LoopField="autoHotkeyGui1") or (A_LoopField="ReBarWindow321")
        GC%a_index%PosY = 0
      tGC%a_index%PosY := GC%a_index%PosY
    }
    IfWinNotExist ahk_id %test%
      Return
    Loop,%Repeat%
    {
       sleep,2000
      Loop,% LastPos -Yend
      {
        i=0
        Loop, Parse, ActiveControlList, `n
        {
          i++
          GC%i%PosY--
          PosY:= GC%i%PosY
          GuiControl %GuiID%:Move ,%A_LoopField%, y%PosY%
        }
        Sleep 50
        IfWinNotExist ahk_id %test%
          Return
      }
      Sleep 15000
      Loop, %ctr%
        GC%a_index%PosY:= tGC%a_index%PosY
    }
    Gui,%GuiID%:Destroy
    Return
  }

55GuiClose:
  Gui, 55:Destroy
Return


GuiEscape:
GuiClose:
  ExitApp


Image


Last edited by haichen on April 11th, 2008, 6:11 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2008, 11:31 am 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
I corrected some small errors wich came by interacting with some other functions and controls (ReBar).
In the first version the text run into the window from below.
Now it runs out of the Gui.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2008, 1:58 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Error with the script above:
Quote:
Error: Target label does not exist. The current thread will exit.
Specifically: g55GuiClose
Line#
033: Gui,55: Add,Text,vText4 yp+30 x10,%TestText%
---> 034: Gui,55: Add,Button,g55GuiClose,test
035: Gui,55: Add,Text,vText5 yp+0 x10,made by haichen
036: Gui,55: Add,Text,vText6 x10,2008


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2008, 2:48 pm 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
Forgot to copy some lines. Sorry.
Corrected now.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2008, 3:57 am 
I dont like it


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, oldbrother and 17 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