Jump to content

IEShakeWindow


wakillon
 Share

Recommended Posts

A Shake script function added to IE for get it moving !
 

If you can't get it working with 3.3.8.1 try with Last beta.

#include <IE.au3>

HotKeySet ( '{ESC}', '_Exit' )

Global $oIE, $Invert, $oIEhwnd

If Not FileExists ( @TempDir & '\wav_1853.wav' ) Then InetGet ( 'http://tinyurl.com/7b86tns', @TempDir & '\wav_1853.wav' )
$oIE = _IECreate ( 'http://www.youtube.com/watch?v=Cc1_UStxZsc', 0, 0 )
$oIE.AddressBar = 0
$oIE.MenuBar = 0
$oIE.StatusBar = 0
$oIE.ToolBar = 0
$oIE.Width = 740
$oIE.Height = 570
$oIEhwnd = HWnd ( $oIE.HWnd )
_IELoadWait ( $oIE )
WinSetOnTop ( $oIEhwnd, '', 1 )
WinMove ( $oIEhwnd, '', ( @DesktopWidth-$oIE.Width )/2, ( @DesktopHeight -$oIE.Height )/2 )
SoundPlay ( @TempDir & '\wav_1853.wav', 0 )
$oIE.visible = 1
_IEShakeWindow ( $oIE, 100 )

While 1
    If Not WinExists ( $oIEhwnd ) Then Exit $oIE=0
    $Invert = Not $Invert
    If $Invert Then
       WinSetTitle ( $oIEhwnd, '', 'Happy Christmas To All AutoIt Members !' )
    Else
        WinSetTitle ( $oIEhwnd, '', '' )
    EndIf
    Sleep ( 1000 )
WEnd

Func _IEShakeWindow ( $oObject, $iNumber )
    $iIEVersion = StringRegExpReplace ( RegRead ( 'HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer', 'Version' ), '^(d+)..+$', '$1' )
    If $iIEVersion Then $iNumber = $iNumber * ( $iIEVersion -6 )
    Local $sJavaCmd = 'var sens=-1;var X=0;var Y=0;' & _
         'for(nb=' & $iNumber & ';nb>1;nb=nb-0.15)' & _
         '{dx=-X+sens*Math.round(nb*Math.random());' & _
         'dy=-Y+sens*Math.round(nb*Math.random());' & _
         'X=X+dx;Y=Y+dy;top.moveBy(dx,dy);sens=sens*(-1);}top.moveBy(-X,-Y);'
    BlockInput ( 1 )
    $oObject.document.parentwindow.execscript ( $sJavaCmd, 'javascript' )
    BlockInput ( 0 )
EndFunc ;==> _IEShakeWindow ()

Func _Exit ()
    If IsObj ( $oIE ) Then $oIE.quit ()
    $oIE=0
    Exit
EndFunc ;==> _Exit ()

Happy Christmas To All AutoIt Members ! :)

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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