Jump to content

I'm Trying To Make A Window Bounce Udf


Recommended Posts

My code is not doing anything, This is my code:

opt( "WinTitleMatchMode", 2)
$window = ""
    $window = WinGetTitle ( $window )
    $pos    = WinGetPos ( $window )
    $x      = $pos[0]
    $y      = $pos[1]
    $width  = $pos[2]
    $height = $pos[3]
    $direct = Random( 1, 2, 1 )
    ConsoleWrite( $direct )
    Select
    Case $direct = 1
        For $y = @DesktopHeight To 1 Step -100
            For $x = @DesktopWidth To 1 Step -100
                WinMove ( "Text Region", "", $x, $y )
            Next
        Next
    Case $direct = 2
        For $y = 1 To @DesktopHeight Step 100
            For $x = 1 To @DesktopWidth Step 100
                WinMove ( "Text Region", "", $x, $y )
            Next
        Next
    EndSelect

Thank you for any help

Edited by zerocool60544

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

maybe

opt( "WinTitleMatchMode", 2)
$window = ""
$wait = 100
    $window = WinGetTitle ( $window )
    $pos    = WinGetPos ( $window )
    $x      = $pos[0]
    $y      = $pos[1]
    $width  = $pos[2]
    $height = $pos[3]
    $direct = 1;Random( 1, 2, 1 )
    ConsoleWrite( $direct )
    Select
    Case $direct = 1
        For $y = @DesktopHeight To 1 Step -100
            For $x = @DesktopWidth To 1 Step -100
                WinMove ($window, "", $x, $y )
                Sleep($wait)
            Next
            Sleep($wait)
        Next
   ;Case $direct = 2
        For $y = 1 To @DesktopHeight Step 100
            For $x = 1 To @DesktopWidth Step 100
                WinMove ( $window, "", $x, $y )
                Sleep($wait)
            Next
            Sleep($wait)
        Next
    EndSelect

8)

NEWHeader1.png

Link to comment
Share on other sites

Thanks man

I have this so far BUT it is not a bounce it is just random.

Any ideas about how I should go about bouncing the windows???

opt( "WinTitleMatchMode", 2)
$window = ""
$wait = 25
    $window = WinGetTitle ( $window )
    $pos    = WinGetPos ( $window )
    $x      = $pos[0]
    $y      = $pos[1]
    $width  = $pos[2]
    $height = $pos[3]
    for $r = 1 To 200
    $direct = Random( 1, 4, 1 )
    If $direct = 1 Then left()
    If $direct = 2 Then up()
    If $direct = 3 Then down()
    If $direct = 4 Then right()
        If $x < 0 Then right()
        If $x + $width > @DesktopWidth Then left()
        If $y < 0 Then down()
        If $y + $height> @DesktopHeight Then up()
        Sleep($wait)
    Next
Func right($dist=50)
    $x = $x + $dist
    WinMove ($window, "", $x, $y )
EndFunc
Func left($dist=50)
    $x = $x - $dist
    WinMove ($window, "", $x, $y )
EndFunc
Func up($dist=50)
    $y = $y - $dist
    WinMove ($window, "", $x, $y )
EndFunc
Func down($dist=50)
    $y = $y + $dist
    WinMove ($window, "", $x, $y )
EndFunc

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

from Autoit Wrappers in my sig

;Animate Display *nice* addition
; Author Raindancer

$hwnd = GUICreate("Animate Window", 300, 300)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000);fade-in
GUISetState()
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00090000);fade-out
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001);slide in from left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050002);slide out to left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040002);slide in from right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050001);slide out to right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040004);slide-in from top
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050008);slide-out to top
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040008);slide-in from bottom
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050004);slide-out to bottom
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040005);diag slide-in from Top-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0005000a);diag slide-out to Top-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040006);diag slide-in from Top-Right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050009);diag slide-out to Top-Right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040009);diag slide-in from Bottom-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050006);diag slide-out to Bottom-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0004000a);diag slide-in from Bottom-right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050005);diag slide-out to Bottom-right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040010);explode
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050010);implode

#define AW_HOR_POSITIVE         0x00000001
#define AW_HOR_NEGATIVE         0x00000002
#define AW_VER_POSITIVE         0x00000004
#define AW_VER_NEGATIVE         0x00000008
#define AW_CENTER                 0x00000010
#define AW_HIDE                 0x00010000
#define AW_ACTIVATE             0x00020000
#define AW_SLIDE                    0x00040000
#define AW_BLEND                    0x00080000

8)

NEWHeader1.png

Link to comment
Share on other sites

Yeah I love that I use it when ever I have a major gui project, thanks but it doesn't help for windows to bounce around the screen

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

maybe...

Run("notepad.exe")
WinWaitActive("")
opt( "WinTitleMatchMode", 2)
$window = ""
$wait = 25
$dist = 50
$dist1 = 50
    $window = WinGetTitle ( $window )
    $pos    = WinGetPos ( $window )
    $x      = $pos[0]
    $y      = $pos[1]
    $width  = $pos[2]
    $height = $pos[3]
    
    for $r = 1 To 200
        If $x < 0 Then $dist = 50
        If $x + $width > @DesktopWidth Then $dist = -50
        If $y < 0 Then $dist1 = 50
        If $y + $height> @DesktopHeight Then $dist1 = -50
        $x = $x + $dist
        $y = $y + $dist1
        Sleep($wait)
        WinMove ($window, "", $x, $y )
    Next

8)

NEWHeader1.png

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