Jump to content

Fade in....


Guest Beefteck
 Share

Recommended Posts

Guest Beefteck

hey wuts up AutoIt members!?! Here i am again with another question that i can not yet find an answer to... I am making another version of my newest program Keyed It Options and need to have the window fade in after clicking it... first of all is this possible and if it is then how would i do this... I am using the newest beta version too so this way ppl know... thankyou for all the help in the past and present -Beefteck :whistle:

Link to comment
Share on other sites

hey wuts up AutoIt members!?! Here i am again with another question that i can not yet find an answer to... I am making another version of my newest program Keyed It Options and need to have the window fade in after clicking it... first of all is this possible and if it is then how would i do this... I am using the newest beta version too so this way ppl know... thankyou for all the help in the past and present -Beefteck :whistle:

I KNOW there is a way to do it. In the AutoIt 1-2-3 tutorial it shows the ability, but I forget the command nor can I find it in the helpfile.

Someone more experienced can point you in the exact direction.

Amp Energy Drink: the official sponsor of me scripting at 2AM.

Link to comment
Share on other sites

  • Moderators

Here, I made a UDF for it, _WinFade():

$MAINGUI = GUICreate('Some Window', 200, 100)
$BUTTON1 = GUICtrlCreateButton('FadeOut', 10, 20, 180, 30)
$BUTTON2 = GUICtrlCreateButton('FadeIn', 10, 55, 180, 30)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $BUTTON1
            _WinFade($MAINGUI, 255, 100)
        Case $BUTTON2
            _WinFade($MAINGUI, 100, 255, 5, 20, 0)
    EndSwitch
WEnd

Func _WinFade($hWnd, $iStart, $iEnd, $iStep = 5, $iSleep = 20, $iFade = 1) ; $iFade - 1 = Fade Out - 0 = Fade In
    If $iFade Then
        For $iCount = $iStart To $iEnd Step - $iStep
            WinSetTrans($hWnd, '', $iCount)
            Sleep($iSleep)
        Next
        Return 1
    ElseIf Not $iFade Then
        For $iCount = $iStart To $iEnd Step $iStep
            WinSetTrans($hWnd, '', $iCount)
            Sleep($iSleep)
        Next
        Return 1
    EndIf
    Return SetError(1, 0, 0)
EndFunc

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Here, I made a UDF for it, _WinFade():

$MAINGUI = GUICreate('Some Window', 200, 100)
$BUTTON1 = GUICtrlCreateButton('FadeOut', 10, 20, 180, 30)
$BUTTON2 = GUICtrlCreateButton('FadeIn', 10, 55, 180, 30)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $BUTTON1
            _WinFade($MAINGUI, 255, 100)
        Case $BUTTON2
            _WinFade($MAINGUI, 100, 255, 5, 20, 0)
    EndSwitch
WEnd

Func _WinFade($hWnd, $iStart, $iEnd, $iStep = 5, $iSleep = 20, $iFade = 1) ; $iFade - 1 = Fade Out - 0 = Fade In
    If $iFade Then
        For $iCount = $iStart To $iEnd Step - $iStep
            WinSetTrans($hWnd, '', $iCount)
            Sleep($iSleep)
        Next
        Return 1
    ElseIf Not $iFade Then
        For $iCount = $iStart To $iEnd Step $iStep
            WinSetTrans($hWnd, '', $iCount)
            Sleep($iSleep)
        Next
        Return 1
    EndIf
    Return SetError(1, 0, 0)
EndFunc

that is so badass....too bad I dont understand anything past the 4th line... :whistle:

EDIT: OK I studied it a bit. quite ingenious! A WinFade() should be added as a built in command in the next release of AutoIt. :)

Edited by mike1305

Amp Energy Drink: the official sponsor of me scripting at 2AM.

Link to comment
Share on other sites

Guest Beefteck

hmmm... well i can not seem to incoperate any of these things into my script, like it will allways need something diffrent like the one above will say "Case -3 No matching Case ...Then... Select line" anway i think i will just wait untill the next release thanks for the good info though

Link to comment
Share on other sites

#include <GuiConstants.au3>

Global Const $AW_FADE_IN = 0x00080000;fade-in
Global Const $AW_FADE_OUT = 0x00090000;fade-out

$MAINGUI = GUICreate('Some Window', 200, 100)
$BUTTON1 = GUICtrlCreateButton('FadeOut', 10, 20, 180, 30)
$BUTTON2 = GUICtrlCreateButton('FadeIn', 10, 55, 180, 30)
GUISetState()
$GUI2 = GUICreate('Some Window2', 200, 100,0,0)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $BUTTON1
            _WinAnimate($GUI2, $AW_FADE_OUT)
        Case $msg = $BUTTON2
            _WinAnimate($GUI2, $AW_FADE_IN)
    EndSelect
WEnd

Func _WinAnimate($v_gui, $i_mode, $i_duration = 1000)
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($v_gui), "int", $i_duration, "long", $i_mode)
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    EndIf
EndFunc;==> _WinAnimate()

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Guest Beefteck

#include <GuiConstants.au3>

Global Const $AW_FADE_IN = 0x00080000;fade-in
Global Const $AW_FADE_OUT = 0x00090000;fade-out

$MAINGUI = GUICreate('Some Window', 200, 100)
$BUTTON1 = GUICtrlCreateButton('FadeOut', 10, 20, 180, 30)
$BUTTON2 = GUICtrlCreateButton('FadeIn', 10, 55, 180, 30)
GUISetState()
$GUI2 = GUICreate('Some Window2', 200, 100,0,0)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $BUTTON1
            _WinAnimate($GUI2, $AW_FADE_OUT)
        Case $msg = $BUTTON2
            _WinAnimate($GUI2, $AW_FADE_IN)
    EndSelect
WEnd

Func _WinAnimate($v_gui, $i_mode, $i_duration = 1000)
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($v_gui), "int", $i_duration, "long", $i_mode)
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    EndIf
EndFunc;==> _WinAnimate()
Ok so this does work but i am having trouble getting my program to fade in on start up and fade out when $msg = GUI_EVENT_CLOSE. basicly here is a very small example i need this to fade in on execution and fade out on ExitLoop. I do belive this is possible but I can am not very good with the .dll calls yet

here is a small black box that will apear somewhere on your screen with and exit button in the menu drop down... here it is:

#include <GUIConstants.au3>

;-------------------------------------------------------------


;-------------------------------------------------------------

GUICreate ("K.I.O v0.8",110,210, 913, 528, $WS_POPUP, $WS_EX_TOPMOST)

GUISetCursor ( 3, 1)

GUISetBkColor (0x000000)

GUISetState()

$filemenu = GuiCtrlCreateMenu ("Menu")
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;-------------------------------------------------------------

While 1
    $msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop

WEnd
Link to comment
Share on other sites

Use a for loop

for $i = 0 to 100

Winsettrans("Window","",$i)

next

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

Guest Beefteck

$GUI1 = GUICreate ("K.I.O v0.8",110,210, 913, 528, $WS_POPUP, $WS_EX_TOPMOST)
_WinAnimate($GUI1, $AW_FADE_IN)
;REST OF PROGRAM

If $mess = $GUI_EVENT_CLOSE Then
        _WinAnimate($GUI1, $AW_FADE_OUT)
        Exit
    EndIf
yess, this is the code I need but every (and I mean every) time I try using these _WinAnimate funcs I will get the error message _WinAnimate($GUI1, $AW_FADE_IN), Unknown Function... i think my pc just like is completly stupid or somthing, what should I do reinstall the public version and re-download the beta version again... o well great code though if anyone could give me a tip on this new problem now (lol, lots of problems :whistle: ) that would be great! than-you for the great help AutoIt Members! :)
Link to comment
Share on other sites

Guest Beefteck

http://www.autoitscript.com/forum/index.ph...amp;#entry84102

Go to that post, and save that script as Animatewindow.au3 in your Autoit/beta/Include folder.

Now, at the top of your script do a #include <Animatewindow.au3> and do a beta-compile.

perfection nice well there we go, this is what I needed... thankyou all so much i will reply again if I need anymore help...
Link to comment
Share on other sites

Guest Beefteck

ok well this is great my new version of K.I.O is coming out soon, now because some screens are different I need this window which is in popup and set to most top mode to be able to be MOVED by it being dragged... i belive i saw this somewhere but i have searched for about 2 days and have found nothing at all, any idea's you can use a code in an above post of mine i think that has some of the options in it (popup, top most) thank-you guys for all your great help and idea's!!! :whistle::):):lmao:

Link to comment
Share on other sites

  • Moderators

Look at WinSetOnTop() and or look at the GUI Control Styles in the Beta help file.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest Beefteck

see i have been looking in the help file for the last few days too and (unless i really skiped it) i can not find it....

Link to comment
Share on other sites

  • Moderators

see i have been looking in the help file for the last few days too and (unless i really skiped it) i can not find it....

Well it's there... styles... Just copy and paste what I wrote there into the index tab input box for keywords (make sure it's the Beta one). But WinSetOnTop() is there also :whistle::)

Edit:

GUI Control Styles

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...