Jump to content
Sign in to follow this  
caramen

shake a window

Recommended Posts

Hello all. 

Dear community, I'm making a script to monitor some windows. 

I would like to know if some of you can advise me or point me in the correct direction to shake a window when some statements are verified. 

 

Thanks in advance for your advises. 


My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

@caramen
Take a look at WinFlash or _WinAPI_FlashWindow* functions :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

I really liked Seminko's find, and thought "ShakeWindow" function should work on any window.
 

; Modified version of "Shake Window" by Death Pax <death_pax@msn.com> from
; https://www.autoitscript.com/forum/topic/22277-new-scrap-shake-window/
; Press Shift-Alt-s keys together and current window with focus will shake.

HotKeySet("{ESC}", "Terminate")
HotKeySet("+!s", "_ShakeWindow") ; Shift-Alt-s

While Sleep(100)
WEnd


Func _ShakeWindow()
    Local $Window = WinGetTitle("", ""), $ShakeAmount = 5, $Win_pos = WinGetPos($Window)
    For $i = 0 To 100
        WinMove($Window, "", $Win_pos[0], $Win_pos[1] + $ShakeAmount * Mod($i, 2))
        Sleep(40)
    Next
EndFunc   ;==>_ShakeWindow

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Share this post


Link to post
Share on other sites

Modify this so it's a quick circle

 

$pi = 4 * ATan(1)
$centerX = @DesktopWidth / 2
$centerY = @DesktopHeight / 2
$RMax = @DesktopHeight / 2
$R = 0

While 1
    For $i = 0 To 2 * $pi Step 0.03125
        WinMove("Untitled - Notepad", "", $centerX + ($R * Cos($i)), $centerY + ($R * Sin($i)))
        $R += 0.5
        If $R > $RMax Then $R = 0
        Sleep(10)
    Next
WEnd

 

Share this post


Link to post
Share on other sites
2 hours ago, badcoder123 said:

Modify this so it's a quick circle

Yes Sir.

Use Shift-Alt-s on this example.

; Modified version of "Shake Window" by Death Pax <death_pax@msn.com> from
; https://www.autoitscript.com/forum/topic/22277-new-scrap-shake-window/
; Press Shift-Alt-a keys together and current window with focus will shake up and down.
; Press Shift-Alt-s keys together and current window with focus will shake circular.

HotKeySet("{ESC}", "Terminate")
HotKeySet("+!a", "_ShakeWindow") ; Shift-Alt-a
HotKeySet("+!s", "_ShakeWindow2") ; Shift-Alt-s

While Sleep(100)
WEnd


Func _ShakeWindow()
    Local $Window = WinGetTitle("", ""), $ShakeAmount = 5, $Win_pos = WinGetPos($Window)
    For $i = 0 To 100
        WinMove($Window, "", $Win_pos[0], $Win_pos[1] + $ShakeAmount * Mod($i, 2))
        Sleep(40)
    Next
EndFunc   ;==>_ShakeWindow

Func _ShakeWindow2()
    Local $Window = WinGetTitle("", ""), $R = 50, $Win_pos = WinGetPos($Window), $pi = 4 * ATan(1)
    Local $Win_pos = WinGetPos($Window), $centerX = $Win_pos[0], $centerY = $Win_pos[1]
    For $i = 0 To 20 * $pi Step $pi / 8
        WinMove($Window, "", $centerX + ($R * Cos($i)), $centerY + ($R * Sin($i)))
        Sleep(10)
    Next
    WinMove($Window, "", $centerX, $centerY)
EndFunc   ;==>_ShakeWindow2

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...