Jump to content

WinCrazyMove function


/\/\1|<3
 Share

Recommended Posts

hi, i coded a new function. maybe you know it from some annoying sites in the internet :lmao:

Func WinCrazyMove($Title, $Text, $EndXPosition, $EndYPosition, $SleepDelay = 0)
    If IsString($Title) = 0 Or IsString($Text) = 0 Or IsNumber($EndXPosition) = 0 Or IsNumber($EndYPosition) = 0 Or IsNumber($SleepDelay) = 0 Then
        SetError(2)
    ElseIf WinExists($Title, $Text) = 0 Then
        SetError(1)
    Else
        
        Local $WindowPosition
        Local $MoveLeft = 1
        Local $MoveUp = 1
        Local $MoveRight = 0
        Local $MoveDown = 0
        Local $XPos
        Local $YPos
        Local $WindowXSize
        Local $WindowYSize
        Local $MoveToX
        Local $MoveToY
        
        $WindowPosition = WinGetPos($Title, $Text)
        $XPos = $WindowPosition[0]
        $YPos = $WindowPosition[1]
        $WindowXSize = $WindowPosition[2]
        $WindowYSize = $WindowPosition[3]
        
        Do
            Select
                Case $MoveLeft = 1
                    $XPos = $XPos - 1
                Case $MoveRight = 1
                    $XPos = $XPos + 1
                EndSelect
            Select
                Case $MoveUp = 1
                    $YPos = $YPos - 1
                Case $MoveDown = 1
                    $YPos = $YPos + 1
                EndSelect
            WinMove($Title, $Text, $XPos, $YPos)
            Select
                Case $XPos = 0
                    $MoveLeft = 0
                    $MoveRight = 1
                Case $XPos + $WindowXSize = @DesktopWidth
                    $MoveRight = 0
                    $MoveLeft = 1
            EndSelect
            Select
                Case $YPos = 0
                    $MoveUp = 0
                    $MoveDown = 1
                Case $YPos + $WindowYSize = @DesktopHeight
                    $MoveDown = 0
                    $MoveUp = 1
                EndSelect
                Sleep($SleepDelay)
        Until ($XPos = $EndXPosition And $YPos = $EndYPosition) Or WinExists($Title, $Text) = 0
    EndIf
EndFunc

Title = the title of the window you want to move

Text = the text of the window you want to move

EndXPosition = the X-position where to stop

EndYPosition = the Y-position where to stop

SleepDelay = the sleepdelay (the lower the sleepdelay is the faster the window will move)

NOTE: it will only stop moving the window when the window arrives at the X and the Y position at the same time, so usually it will never stop o:)

Mike.

Edited by /\/\1|<3
Link to comment
Share on other sites

i think i have a program like this somewhere that i got off the net where it says to buy beer and you cant close it because it moves away

edit: every time i try it i get an error :lmao:

how come this doesnt work

Run ( "notepad" )
WinWait ( "Untitled - Notepad" )
send ( "text" )
WinCrazyMove ( "Unitled - Notepad", "text", 1, 1, 1 )
If @error = 1 or @error = 2 then 
    WinKill ( "Untitled - Notepad" )
    msgbox ( 0, "error", "error" )
EndIf
Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

try...

Run ( "notepad.exe" )
WinWait ( "Untitled - Notepad" )
send ( "text" )
WinCrazyMove ( "Unitled - Notepad", "text", 1, 1, 1 )
If @error = 1 or @error = 2 then
    WinKill ( "Untitled - Notepad" )
    msgbox ( 0, "error", "error" )
EndIf

im not sure if it'll work im a noob at this

tell me if it works :lmao:

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