Jump to content

Problem with Animation Text..


eri
 Share

Recommended Posts

I have create Gui with animation Text.. Got sample from this Forum..

And Transparat Gui from Melba :D

But Button Not Working.. Please Correct and Add script for me..

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <Constants.au3>
#include <WinAPI.au3>
#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Global $iX, $iY, $hGUI, $hGUI_child

_Main()

Func _Main()
    Local $button1, $button2, $button3, $button4, $button5
    Local  $label

    ; Create main GUI
$hGUI = GUICreate("test", 246, 243)
$button1 = GUICtrlCreateButton("Notepad", 47, 185, 70, 25, 0)
$button2 = GUICtrlCreateButton("Regedit", 170, 185, 70, 25, 0)
$button3 = GUICtrlCreateButton("Calc", 5, 215, 45, 25, 0)
$button4 = GUICtrlCreateButton("cmd", 52, 215, 45, 25, 0)
$button5 = GUICtrlCreateButton("TaskMgr", 99, 215, 55, 25, 0)
 GUISetState(@SW_SHOW)

    _GUICreateInvRect($hGUI, 5, 30, 240, 160)

    ; Get main GUI position
    Local $aPos = WinGetPos($hGUI)
    $iX = $aPos[0] + 5
    $iY = $aPos[1] + 30

    ; Create child GUI
    $hGUI_child = GUICreate("", 240, 160, $iX, $iY, BitOR($WS_POPUP, $WS_BORDER), -1, WinGetHandle(AutoItWinGetTitle()))
    GUISetBkColor(0xFF0000, $hGUI_child)
    WinSetTrans($hGUI_child, "", 200)
    $label = GUICtrlCreateLabel(" Try Animation Text and Some Application But All Button Not Working, So I go to The Forum To Get The Solution", 12, 10, 228, 160,$SS_CENTER)
    GUICtrlSetFont(-1, 12, 400, 0, "Comic Sans MS")
    GUISetState()

    ;Register move event to keep child synchroed with main
    GUIRegisterMsg($WM_MOVE, "My_WM_MOVE")

    ; Run the GUI until the dialog is closed
While 1
    For $x = 1 To 250
        GUICtrlSetPos($label, 0, 100-$x)
        Sleep(20)
    Next
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $button1
                Run ("notepad.exe")
            Case $button2
                Run ("Regedit.exe")
            Case $button3
                Run ("calc.exe")
            Case $button4
                Run ("cmd.exe")
            Case $button5
                Run ("taskmgr.exe")
        EndSwitch

        If (BitAND(WinGetState($hGUI), 16) = 16) And (BitAND(WinGetState($hGUI), 16) <> 16) Then
            WinSetState($hGUI_child, "", @SW_MINIMIZE)
        ElseIf (BitAND(WinGetState($hGUI), 2) = 2) And (BitAND(WinGetState($hGUI), 16) - 16) Then
            WinSetState($hGUI_child, "", @SW_RESTORE)
        EndIf
    WEnd
    GUIDelete()
EndFunc   ;==>_Main


    Func My_WM_MOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $iMsg, $wParam, $lParam

    If $hWnd <> $hGUI Then Return
    Local $aPos = WinGetPos($hGUI)
    _WinAPI_SetWindowPos($hGUI_child, $hGUI, $aPos[0] + 5, $aPos[1] + 30, 240, 160, $SWP_NOACTIVATE)

EndFunc   ;==>My_WM_MOVE

Func _GUICreateInvRect($hWnd, $iX, $iY, $iW, $iH)

    Local $hMask_1 = _WinAPI_CreateRectRgn(0, 0, @DesktopWidth, $iY)
    Local $hMask_2 = _WinAPI_CreateRectRgn(0, 0, $iX, @DesktopHeight)
    Local $hMask_3 = _WinAPI_CreateRectRgn($iX + $iW, 0, @DesktopWidth, @DesktopHeight)
    Local $hMask_4 = _WinAPI_CreateRectRgn(0, $iY + $iH, @DesktopWidth, @DesktopHeight)

    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_2, 2)
    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_3, 2)
    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_4, 2)

    _WinAPI_DeleteObject($hMask_2)
    _WinAPI_DeleteObject($hMask_3)
    _WinAPI_DeleteObject($hMask_4)

    _WinAPI_SetWindowRgn($hWnd, $hMask_1, 1)

EndFunc   ;==>_GUICreateInvRect
Link to comment
Share on other sites

  • Moderators

eri,

Look carefully at what your code is doing:

; Run the GUI until the dialog is closed
While 1
    For $x = 1 To 250 
        GUICtrlSetPos($label, 0, 100-$x)
        Sleep(20)
    Next
    Switch GUIGetMsg()
        ; Various Case statements
    EndSwitch
    
    ; Some IF statements

WEnd

How long do think the For...Next loop lasts? I would say 250 x 20ms (that is a whole 5 seconds) - during which time NOTHING else can happen in your script. You need to put the other elements of the While...WEnd loop inside the For...Next loop like this:

; Run the GUI until the dialog is closed
While 1

    For $x = 1 To 250
        GUICtrlSetPos($label, 0, 100-$x)
        ;Sleep(20)  ; Not needed as you have a GUIGetMsg command in the loop now!!!!
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop 2
            ; Other Case statements
        EndSwitch

        ; Some IF statements

    Next
WEnd

You might need to speed up your scrolling a bit now, though! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thank`s Melba.. I will learn and learn to understand the AutoIt. Because AutoIt is the first software that I know to write a script. And I'm collecting examples To understand AutoIt. thank`s for guidance..

And Can you give me examples of script that you have.. :D

Link to comment
Share on other sites

  • Moderators

eri,

There are a few of my more complicated scripts in the Examples forum:

Toast, ExtMsgBox, NoFocusLines, and AvColour.

And there are lots of other snippets scattered all over the forum. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

eri,

There are a few of my more complicated scripts in the Examples forum:

Toast, ExtMsgBox, NoFocusLines, and AvColour.

And there are lots of other snippets scattered all over the forum. :huggles:

M23

Thank`s I will read And try It`s.. :D

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...