Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_UseX64=n
- #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #include <GuiListView.au3>
- #include <Array.au3>
- #include <GUIConstantsEx.au3>
- #include <WindowsConstants.au3>
- Global $array[1][5], $ready = 1
- WinWait("Program Manager")
- $hWnd_LV = _GetDesktopHandle()
- Global $array[_GUICtrlListView_GetItemCount($hWnd_LV)][5]
- ; Icons in Array einlesen
- For $i = 0 To _GUICtrlListView_GetItemCount($hWnd_LV) - 1
- $array[$i][0] = _GUICtrlListView_GetItemPositionX($hWnd_LV, $i)
- $array[$i][1] = _GUICtrlListView_GetItemPositionY($hWnd_LV, $i)
- If Random(0, 1, 1) = 1 Then
- $array[$i][2] = Random(0, @DesktopWidth, 1)
- $array[$i][3] = _RandomOr(0, @DesktopHeight)
- Else
- $array[$i][2] = _RandomOr(0, @DesktopWidth)
- $array[$i][3] = Random(0, @DesktopHeight, 1)
- EndIf
- ;$array[$i][2] = $array[$i][0]
- ;$array[$i][3] = @DesktopHeight
- $array[$i][4] = 0
- Next
- While 1
- $ready = 1
- _GUICtrlListView_BeginUpdate($hWnd_LV)
- For $i = 0 To UBound($array) - 1 Step +1
- If $array[$i][0] > $array[$i][2] Then
- $array[$i][2] += 0.5
- $ready = 0
- ElseIf $array[$i][2] > $array[$i][0] Then
- $array[$i][2] -= 0.5
- $ready = 0
- EndIf
- If $array[$i][1] > $array[$i][3] Then
- $array[$i][3] += 0.5
- $ready = 0
- ElseIf $array[$i][3] > $array[$i][1] Then
- $array[$i][3] -= 0.5
- $ready = 0
- EndIf
- _GUICtrlListView_SetItemPosition($hWnd_LV, $i, $array[$i][2], $array[$i][3])
- Next
- _GUICtrlListView_EndUpdate($hWnd_LV)
- If $ready = 1 Then
- ExitLoop
- EndIf
- WEnd
- Func _GetDesktopHandle()
- $hDeskWin = WinGetHandle("[CLASS:Progman]")
- $hListView = ControlGetHandle($hDeskWin, '', '[CLASS:SysListView32; INSTANCE:1]')
- If $hDeskWin = '' Or $hListView = '' Then
- ConsoleWrite("Looking through WorkerW windows.." & @CRLF)
- $aWinList = WinList("[CLASS:WorkerW]")
- For $i = 1 To $aWinList[0][0]
- $hListView = ControlGetHandle($aWinList[$i][1], '', '[CLASS:SysListView32; INSTANCE:1]')
- If $hListView <> '' Then ExitLoop
- Next
- If $i <= $aWinList[0][0] Then $hDeskWin = $aWinList[$i][1]
- EndIf
- If $hListView = '' Then Exit
- Return $hListView
- EndFunc ;==>_GetDesktopHandle
- Func _RandomOr($a, $b)
- If Random(0, 1, 1) = 1 Then
- Return $b
- Else
- Return $a
- EndIf
- EndFunc ;==>_RandomOr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement