Jump to content

New Scrap: Shake Window


death pax
 Share

Recommended Posts

Well, lately Ive been working on a chat client and I decided i should create the functionality of the "Nudge" on msn or "BUZZ!" on yahoo, so i made this simple function for all to enjoy!

; ----------------------------------------------------------------------------
; Shake Window
; Author:        Death Pax <death_pax@msn.com>
;
; Script Function:
;   Shake Window
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>
$Gui_Main = GUICreate("Shake Window", 400, 400)
$Button_Shake = GUICtrlCreateButton("Shake Window", 24, 352, 121, 33, 0)
$Button_Close = GUICtrlCreateButton("Close Window", 256, 352, 121, 33, 0)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_Close
        ExitLoop
    Case $msg = $Button_Shake
        _ShakeWindow($Gui_Main, 5)
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit

Func _ShakeWindow($Window,$ShakeAmount)
    $Win_pos=WinGetPos($Window)
    For $i=0 to 20 step 1
    WinMove($Window,"", $Win_pos[0],$Win_pos[1]+$ShakeAmount)
    Sleep(10)
    WinMove($Window,"", $Win_pos[0]+$ShakeAmount,$Win_pos[1])
    Sleep(10)
    WinMove($Window,"", $Win_pos[0],$Win_pos[1]-$ShakeAmount)
    Sleep(10)
    WinMove($Window,"", $Win_pos[0]-$ShakeAmount,$Win_pos[1])
    Sleep(10)
    WinMove($Window,"", $Win_pos[0],$Win_pos[1])
    Sleep(10)
    next
EndFunc

let me know what you think of it ^.^

Edited by death pax
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...