Advertisement
Guest User

Icon Animator

a guest
May 31st, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.29 KB | None | 0 0
  1. #region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_UseX64=n
  3. #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
  4. #include <GuiListView.au3>
  5. #include <Array.au3>
  6. #include <GUIConstantsEx.au3>
  7. #include <WindowsConstants.au3>
  8. Global $array[1][5], $ready = 1
  9. WinWait("Program Manager")
  10. $hWnd_LV = _GetDesktopHandle()
  11. Global $array[_GUICtrlListView_GetItemCount($hWnd_LV)][5]
  12. ; Icons in Array einlesen
  13. For $i = 0 To _GUICtrlListView_GetItemCount($hWnd_LV) - 1
  14.     $array[$i][0] = _GUICtrlListView_GetItemPositionX($hWnd_LV, $i)
  15.     $array[$i][1] = _GUICtrlListView_GetItemPositionY($hWnd_LV, $i)
  16.     If Random(0, 1, 1) = 1 Then
  17.         $array[$i][2] = Random(0, @DesktopWidth, 1)
  18.         $array[$i][3] = _RandomOr(0, @DesktopHeight)
  19.     Else
  20.         $array[$i][2] = _RandomOr(0, @DesktopWidth)
  21.         $array[$i][3] = Random(0, @DesktopHeight, 1)
  22.     EndIf
  23.     ;$array[$i][2] = $array[$i][0]
  24.     ;$array[$i][3] = @DesktopHeight
  25.     $array[$i][4] = 0
  26. Next
  27.  
  28. While 1
  29.     $ready = 1
  30.     _GUICtrlListView_BeginUpdate($hWnd_LV)
  31.     For $i = 0 To UBound($array) - 1 Step +1
  32.         If $array[$i][0] > $array[$i][2] Then
  33.             $array[$i][2] += 0.5
  34.             $ready = 0
  35.         ElseIf $array[$i][2] > $array[$i][0] Then
  36.             $array[$i][2] -= 0.5
  37.             $ready = 0
  38.         EndIf
  39.         If $array[$i][1] > $array[$i][3] Then
  40.             $array[$i][3] += 0.5
  41.             $ready = 0
  42.         ElseIf $array[$i][3] > $array[$i][1] Then
  43.             $array[$i][3] -= 0.5
  44.             $ready = 0
  45.         EndIf
  46.         _GUICtrlListView_SetItemPosition($hWnd_LV, $i, $array[$i][2], $array[$i][3])
  47.     Next
  48.     _GUICtrlListView_EndUpdate($hWnd_LV)
  49.     If $ready = 1 Then
  50.         ExitLoop
  51.     EndIf
  52. WEnd
  53.  
  54. Func _GetDesktopHandle()
  55.     $hDeskWin = WinGetHandle("[CLASS:Progman]")
  56.     $hListView = ControlGetHandle($hDeskWin, '', '[CLASS:SysListView32; INSTANCE:1]')
  57.     If $hDeskWin = '' Or $hListView = '' Then
  58.         ConsoleWrite("Looking through WorkerW windows.." & @CRLF)
  59.         $aWinList = WinList("[CLASS:WorkerW]")
  60.         For $i = 1 To $aWinList[0][0]
  61.             $hListView = ControlGetHandle($aWinList[$i][1], '', '[CLASS:SysListView32; INSTANCE:1]')
  62.             If $hListView <> '' Then ExitLoop
  63.         Next
  64.         If $i <= $aWinList[0][0] Then $hDeskWin = $aWinList[$i][1]
  65.     EndIf
  66.     If $hListView = '' Then Exit
  67.     Return $hListView
  68. EndFunc   ;==>_GetDesktopHandle
  69.  
  70.  
  71. Func _RandomOr($a, $b)
  72.     If Random(0, 1, 1) = 1 Then
  73.         Return $b
  74.     Else
  75.         Return $a
  76.     EndIf
  77. EndFunc   ;==>_RandomOr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement