-
Posts
2,661 -
Joined
-
Last visited
-
Days Won
36
Gianni's Achievements
-
Gianni reacted to a post in a topic: How to avoid MS defenders to delete executable file created.
-
Gianni reacted to a post in a topic: Need help to make a 4k video player
-
Gianni reacted to a post in a topic: Need help to make a 4k video player
-
Gianni reacted to a post in a topic: WinRT Object Libraries
-
Gianni reacted to a post in a topic: WinRT Object Libraries
-
Hi @MattyD,First of all, thank you for this work you are doing. From a first look at the WinRT UDF, I see that the _WinRT_WaitForAsync function is used to block the execution of the main script until the expected event is raised (or expires). I would like to ask you if there is a way to use something similar to the AutoIt ObjEvent() function as an alternative (or maybe, even better, use that function directly). That is, give the user the possibility to pass the name of their own function attached to an event that will be called asynchronously when that event occurs? I apologize in advance if I misunderstood the mechanism of the _WinRT_WaitForAsync() function ... bye and thank you
-
Gianni reacted to a post in a topic: WinRT Object Libraries
-
Gianni reacted to a post in a topic: WinRT Object Libraries
-
bdr529 reacted to a post in a topic: _ArrayUnique on multiple columns
-
ioa747 reacted to a post in a topic: Microsoft Edge - WebView2, embed web code in your native application
-
ioa747 reacted to a post in a topic: Microsoft Edge - WebView2, embed web code in your native application
-
Netol reacted to a post in a topic: versatile multi ping
-
Netol reacted to a post in a topic: versatile multi ping
-
Gianni reacted to a post in a topic: _DateDuration
-
with the changes suggested by @UEZ it works for me try putting #AutoIt3Wrapper_UseX64=n at the beginning of the script
-
Hi @Blaxxun, ... if you want to try something similar you can take a look at my _crop() function found here: https://www.autoitscript.com/forum/topic/203545-%E2%9C%82%EF%B8%8F-quick-crop-tool Below is a simple script if you're interested in trying it out. I hope it can be of use to you. #include <GUIConstantsEx.au3> #include <croptool.au3> ; <-- https://www.autoitscript.com/forum/topic/203545-%E2%9C%82%EF%B8%8F-quick-crop-tool Opt("GUICloseOnESC", 0) ; Simple example of use of the _Crop() function ; ; it allows you to freely and visually select an area of the screen ; ; - To resize the area click the left mouse button on any of the moving colored edges of the tool and drag. ; You can also LeftClick within the selected area and drag to move the whole selector. ; ; - To terminate the selection operation RightClick within the selected area. ; ; You can alse terminate the selection operation by hitting the ESC key; ; in that case the @extended macro will be setted to true Example() Func Example() ; Create an example GUI Local $hGui = GUICreate("Crop Demo", 220, 105, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) ; Create buttons Local $Crop = GUICtrlCreateButton("Start cropping", 10, 10, 200, 25) Local $Crop_hide_me = GUICtrlCreateButton("Hide me and crop", 10, 40, 200, 25) Local $Close = GUICtrlCreateButton("Close", 10, 70, 200, 25) ; Display the example GUI GUISetState(@SW_SHOW, $hGui) Local $aSelection = 0, $bExtended = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Close ExitLoop Case $Crop ; start the crop tool $aSelection = _crop() $bExtended = @extended Case $Crop_hide_me ; hide this gui and start the crop tool GUISetState(@SW_HIDE, $hGui) $aSelection = _crop() $bExtended = @extended GUISetState(@SW_SHOW, $hGui) EndSwitch If $bExtended Then MsgBox(48, "Esc pressed", "no crop area selected") $aSelection = '' $bExtended = 0 EndIf If IsArray($aSelection) Then MsgBox(64, 'Coordinates of the selected area', _ "UpperLeft X : " & $aSelection[0] & @CRLF & _ "UpperLeft Y : " & $aSelection[1] & @CRLF & _ "Width : " & $aSelection[2] & @CRLF & _ "Height : " & $aSelection[3]) $aSelection = '' EndIf WEnd ; Delete the GUI GUIDelete($hGui) EndFunc ;==>Example
-
Jacov reacted to a post in a topic: Startint 'new Teams'
-
ShellExecute('ms-teams.exe')
-
Get all computers connected to the router
Gianni replied to AutID's topic in AutoIt General Help and Support
hi @casi4711 the address "192.168.178" is incomplete and represents neither a range nor a single address. What address range do you intend to ping? For example, if you want to ping all addresses from 192.168.178.0 to 192.168.178.255 then you can use this range value "192.168.178.*" the asterisk indicates all possible values (0 to 255) for other possible examples of valid ranges take a look here: https://www.autoitscript.com/forum/topic/156395-versatile-multi-ping -
Get all computers connected to the router
Gianni replied to AutID's topic in AutoIt General Help and Support
Hi @casi4711 here's a "quick and dirty" modification to the above script that should achieve what you're asking for when you double-click on a "computer". I hope it is useful to you bye ; this is to ping continuously a list of IP addresses, get and display ping result "live" ; it simulates the dos "ping -t" command but performed simultaneously on many IP ; presenting the results in a ListView highlighting not responding devices with a red box #include <GUIConstantsEx.au3> #include <Array.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <ListviewConstants.au3> #include <WindowsConstants.au3> #include 'MultiPing.au3' ; <-- take this from the following link : ; http://www.autoitscript.com/forum/topic/156395-versatile-multi-ping Global $listview, $hLV_Handle, $iRow, $bClick = False _IP_Scanner() Func _IP_Scanner($IP_range = '', $IP_mask = '') ; Local $IP_range = "" ; range to be pinged (leave it empty to ping all local lan) ; Local $IP_mask = "" Local $sClickedItemText Opt("GUIOnEventMode", 1) HotKeySet("{esc}", "_button1") Local $Win_X = 600, $Win_Y = 600 ; dimension of window Local $PingGui = GUICreate("IP addresses monitor", $Win_X, $Win_Y, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_button1", $PingGui) $listview = GUICtrlCreateListView("", 10, 10, $Win_X - 20, $Win_Y - 40) $hLV_Handle = GUICtrlGetHandle($listview) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY_Handler") GUICtrlSetFont(-1, 6) GUICtrlSetStyle($listview, $LVS_ICON + $LVS_NOLABELWRAP) ; Generate colored square images $hImage = _GUIImageList_Create(16, 16) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFFFF00, 16, 16)) ; yellow _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 16, 16)) ; red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 16, 16)) ; green _GUICtrlListView_SetImageList($listview, $hImage, 0) $button1 = GUICtrlCreateButton("Exit", 10, $Win_Y - 25, $Win_X - 20, 20) GUICtrlSetTip(-1, "End of program") GUICtrlSetOnEvent(-1, "_button1") GUISetState(@SW_SHOW) $MyArray = _nPing($IP_range, $IP_mask, 1, 1) ; first call is to generate the array ; this will search for all active IP devices ; and make a "snapshot" in the $MyArrat _ArrayDelete($MyArray, 0) ; remove first item ; _ArrayDisplay($MyArray) _GUICtrlListView_BeginUpdate($listview) _GUICtrlListView_AddArray($listview, $MyArray) ; and fill ListView _GUICtrlListView_EndUpdate($listview) While 1 ; continuously ping addresses of the snapshot previously generated Sleep(10) _nPing($MyArray, 0, 0, 0, "_refresh") ; PING required addresses and call the _refresh() function ; for each terminated ping (reasults of ping are passed to function) ; ; ------------------------------------------------------ ; ---- manage your click (doubleclick) action here below ; ------------------------------------------------------ If $bClick Then $bClick = False ; clear the flag immediately $sClickedItemText = _GUICtrlListView_GetItemText($hLV_Handle, $iRow) ; Clicked device (IP address) ; ConsoleWrite('Debug: --> ' & $sClickedItemText & @CRLF) If $sClickedItemText Then ShellExecute('\\' & $sClickedItemText & '\c$') EndIf ; ------------------------------------------------------ ; WEnd EndFunc ;==>_IP_Scanner Func _button1() ; Button 1 clicked Exit EndFunc ;==>_button1 Func _refresh($Params) ; this receive ping results and displays them in the ListView _GUICtrlListView_SetItemImage($listview, $Params[5], 0) ; set colour to Yellow Sleep(50) ; a little wait If $Params[4] = -1 Then ; Device not responding to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 1) ; set colour to RED _GUICtrlListView_EnsureVisible($listview, $Params[5]) ; Position view to this item Else ; Device responds to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 2) ; set colour to GREEN EndIf EndFunc ;==>_refresh ; https://www.autoitscript.com/forum/topic/155607-how-to-detect-which-listview-was-clicked/ Func _WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return Switch DllStructGetData($tStruct, 1) Case $hLV_Handle If BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) = $NM_DBLCLK Then $iRow = DllStructGetData($tStruct, 4) ; $iCol = DllStructGetData($tStruct, 5) ; Set flags $bClick = True EndIf Case Else Return EndSwitch EndFunc ;==>_WM_NOTIFY_Handler -
Recursive _ArrayDisplay and _DebugArrayDisplay
Gianni replied to Nine's topic in AutoIt Example Scripts
... if you prefer to view the contents of nested arrays within the same window rather than opening different windows for each subarray you can also try this other array viewer: https://www.autoitscript.com/forum/topic/182856-array-viewer -
Exit do not Exit the script
Gianni replied to Lorenzopier's topic in AutoIt General Help and Support
(??) should only return that message to you once. however the "Run" command requires the complete path of the program to be executed. You can try with "ShellExecute" instead of "Run" -
Hi @jguinch regardless of nested arrays, what I mean is that the script you posted above doesn't seem to work as it is if we want to implement that "paradigm", then this script seems to work. (by the way, this also works with nested arrays) (p.s. I hope there are no bugs here... 😀) Further interesting reading about this topic: https://codegolf.stackexchange.com/questions/79609/index-of-a-multidimensional-array https://codegolf.stackexchange.com/questions/37905/mixed-base-conversion ...As mentioned in a comment in the first of above links: "Indexing a multidimensional array is essentially mixed base conversion" p.s. ... I forgot to give credit. The mathematics behind the script is by @Nine from this topic: https://www.autoitscript.com/forum/topic/206284-mixed-base-conversion-coding-challenge/ _Example() Func _Example() Local $aExampleArray[2][3][4] = [[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0]]] Local $aExampleArray1[2][3][4] = [[["Hello", "", "", ""], ["", "", "", ""], ["", "", "", ""]], [["", "", "", ""], ["", "", "", ""], ["", "", "", ""]]] $aExampleArray[1][2][3] = $aExampleArray1 ; <-- here I inject a nested array MsgBox(0, "Example", "Is Array empty? -> " & _ArrayIsEmpty($aExampleArray)) EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayIsEmpty ; Description ...: Scans an entire array to check if it is "empty" ; Syntax ........: _ArrayIsEmpty(Byref $aInput) ; Parameters ....: $aInput - [in] an array ; ; Return values .: Success - True or False (depending on whether empty or not empty) ; ; - If passed argument is not an array ; @error is set to 1 and returns the Null value ; ; Author ........: Gianni ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ArrayIsEmpty(ByRef $aInput) If Not IsArray($aInput) Then Return SetError(1, 0, Null) Local $iSubscripts = UBound($aInput, 0), $aSubscripts[$iSubscripts], $sDimensions, $iSubscriptElements Local $iTotElements = 1, $sLeadingZero, $vContent, $bIsEmpty, $iDigit = -1 For $i = 0 To $iSubscripts - 1 $aSubscripts[$i] = UBound($aInput, $i + 1) $iTotElements *= $aSubscripts[$i] $sLeadingZero &= '[0]' Next For $iIndex = 0 To $iTotElements - 1 $iSubscriptElements = $iIndex $sDimensions = $iSubscriptElements ? "" : "[0]" While $iSubscriptElements ; Calculate the value of each subscript $iDigit += 1 $multiplier = $aSubscripts[$iSubscripts - Mod($iDigit, $iSubscripts) - 1] $sDimensions = "[" & Mod($iSubscriptElements, $multiplier) & "]" & $sDimensions $iSubscriptElements = Floor($iSubscriptElements / $multiplier) WEnd $iDigit = -1 $sDimensions = StringMid($sLeadingZero & $sDimensions, StringInStr($sLeadingZero & $sDimensions, '[', 0, -$iSubscripts)) $vContent = Execute("$aInput" & $sDimensions) ; ConsoleWrite("Debug: " & $sDimensions & @TAB & $vContent & @TAB & VarGetType($vContent) & @CRLF) $bIsEmpty = IsArray($vContent) ? _ArrayIsEmpty($vContent) : Not $vContent If Not $bIsEmpty Then Return False ; Is not empty Next Return True ; Is empty EndFunc ;==>_ArrayIsEmpty
-
Hi @jguinch Looks like the list needs some fixing. Also it wasn't designed to accept nested arrays, right?
-
Hi @Nine Thanks for simplifying the code. My "reduction" was just a quick adaptation of more complicated code intended to simulate nested For-Next loops with the ability to set the initial value of each loop, different step values both positive and negative for each nesting... just like the real For -next loops. (for those interested and needing to use it, the complete code for the For-Next simulator can be found here: https://www.autoitscript.com/forum/topic/180468-traversing-array/?do=findComment&comment=1296451 ) The adaptation used here, as well as your optimization, only allows simpler loops but which for this use case are optimal.
-
Hi @genius257 Just a small oversight: I tried to "build" example.au3 from example.au3p using build.au3 the output file produced contains this little "flaw": If $pObj=0 Then Return $__AOI_E_POINTER "C:\Temp\au3class-master\Example\Example.au3"(30,40) : warning: $__AOI_E_POINTER: possibly used before declaration. If $pObj=0 Then Return $__AOI_E_POINTER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Temp\au3class-master\Example\Example.au3"(30,40) : error: $__AOI_E_POINTER: undeclared global variable. If $pObj=0 Then Return $__AOI_E_POINTER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ apart from this the created "object" works correctly.
-
although I think BrowserControl ActiveX is still an option for creating simple interactive interfaces embedded in AutoIt GUI, perhaps the most promising option is to use WebView2. The basic system created by @LarsJ, although still in a "work in progress" state, it can already be used to create something at least functional. It would be interesting to continue developing it to make it more complete and simple to use...
-
In this topic from some time ago (https://www.autoitscript.com/forum/topic/180468-traversing-array/), we were basically discussing how to traverse all the elements of a generic array whose dimensions are unknown. Well in the last post of that thread I posted a way to achieve that. Using that function can save "a few" bytes and shorten the function considerably. You can pass multidimensional arrays and even arrays that contain nested arrays without any problems. I coded the logic whether to consider an element empty or not empty in the function itself on line 30 of the listing rather than passing it via parameter so as to be able to better customize the criterion. Func IsArrayEmpty(ByRef $aMyArray) If Not IsArray($aMyArray) Then Return SetError(1, 0, -1) Local $iDimensions = UBound($aMyArray, 0) Local $sArraySubscript = "$aMyArray" For $i = 0 To $iDimensions - 1 $sArraySubscript &= '[$aLoops[' & $i & '][2]]' Next Local $aLoops[$iDimensions][3] For $i = 0 To $iDimensions - 1 $aLoops[$i][0] = 0 $aLoops[$i][1] = UBound($aMyArray, $i + 1) - 1 $aLoops[$i][2] = $aLoops[$i][0] Next Local $x, $vContent Do $vContent = Execute($sArraySubscript) If IsArray($vContent) Then $IsEmpty = IsArrayEmpty($vContent) ; <-- recursive call for nested arrays Else ; check out your "voidness" logic here ; ------------------------------------ $IsEmpty = ($vContent = '') Or ($vContent = False) Or ($vContent = Null) ; ...... up to you decide EndIf If Not $IsEmpty Then Return False ; Is not Empty $x = UBound($aLoops) - 1 $aLoops[$x][2] += 1 While ($aLoops[$x][2] > $aLoops[$x][1]) $aLoops[$x][2] = $aLoops[$x][0] $x -= 1 If $x < 0 Then ExitLoop $aLoops[$x][2] += 1 WEnd Until $x < 0 Return True ; Is Empty EndFunc ;==>IsArrayEmpty
-
For comparative testing purposes I tried to translate the script created by @Numeric1 at this link which uses AutoitObject, so as to use AutoItObject_Internal.au3 by @genius257 instead. (The latter does not require additional DLLs.). Maybe it seems a little slower and slightly less responsive (?) P.S. I created a new thread just to not hijack @Numeric1's original thread. (any improvements and corrections relating to the translation of the listing are welcome) ; =============================================================================================================================== ; original script created by @Numeric1 at the link below ; https://www.autoitscript.com/forum/topic/211824-ping-pong-game-with-autoitobject/ ; =============================================================================================================================== ; Game Overview: ; - The game consists of a paddle and a ball. ; - The player controls the paddle using the left and right arrow keys. ; - The objective is to bounce the ball off the paddle and prevent it from hitting the bottom edge of the window. ; - If the ball hits the bottom edge, the game ends. ; - As the game progresses, the speed of the ball increases periodically, making it more challenging. ; Controls: ; - Left Arrow Key: Move the paddle to the left. ; - Right Arrow Key: Move the paddle to the right. ; - S Key: Pause the game. ; - When the game is paused, press Left or Right arrow key to resume. ; Enjoy playing Ping Pong! ; =============================================================================================================================== #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> ; #include "AutoItObject.au3" #include "AutoItObject_Internal.au3" ; <-- https://www.autoitscript.com/forum/topic/185720-autoitobject-pure-autoit #include <Misc.au3> Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _GDIPlus_Startup() Const $COLOR_RED = 0xFFFF0000 Const $COLOR_GREEN = 0xFF00FF00 Func Ball($x = 0, $y = 0, $size = 5) Local $cBall = IDispatch() ; _AutoItObject_Class() With $cBall .dx = 10 .dy = -10 .size = $size .X = $x .Y = $y .__defineGetter("move", _move) EndWith Return $cBall ; .Object EndFunc ;==>Ball Func Paddle($x = 0, $size = 5) Local $cPaddle = IDispatch() ; _AutoItObject_Class() With $cPaddle .X = $x .size = $size .dx = 20 .__defineGetter("moveLeft", _moveLeft) .__defineGetter("moveRight", _moveRight) EndWith Return $cPaddle ; .Object EndFunc ;==>Paddle Func _moveLeft($this) $this.parent.X -= $this.parent.dx If $this.parent.X < 0 Then $this.parent.X = 0 EndFunc ;==>_moveLeft Func _moveRight($this) ; , $maxX) Local $maxX = $this.arguments.values[0] Local $paddleWidth = $this.parent.size If $this.parent.X + $this.parent.dx + $paddleWidth <= $maxX Then $this.parent.X += $this.parent.dx Else $this.parent.X = $maxX - $paddleWidth EndIf EndFunc ;==>_moveRight Func GamePanel() Local $hGUI = GUICreate("Ping Pong", 400, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) GUISetBkColor(0x000000) GUISetState() Local $aClient = WinGetClientSize($hGUI) If @error Then Return SetError(1, 0, 0) Local $iWidth = $aClient[0] Local $iHeight = $aClient[1] Local $aGDIMap[5] $aGDIMap[0] = _GDIPlus_GraphicsCreateFromHWND($hGUI) $aGDIMap[1] = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $aGDIMap[0]) $aGDIMap[2] = _GDIPlus_ImageGetGraphicsContext($aGDIMap[1]) $aGDIMap[3] = _GDIPlus_BrushCreateSolid($COLOR_RED) $aGDIMap[4] = _GDIPlus_HatchBrushCreate(4, $COLOR_GREEN) Local $Ball = Ball(40, 40) Local $paddleX = Paddle(150, 100) Local $cGamePanel = IDispatch() ; _AutoItObject_Class() With $cGamePanel .iWidth = $iWidth .iHeight = $iHeight .ball = $Ball .paddle = $paddleX .map = $aGDIMap .speedLevel = 100 .__defineGetter("move", _move) .__defineGetter("drawStage", _drawStage) .__defineGetter("cleanUpResources", _cleanUpResources) .__destructor(_cleanUpResources) .__defineGetter("runGameLoop", _runGameLoop) EndWith Return $cGamePanel ; .Object EndFunc ;==>GamePanel Func _move($this) Local $x = $this.parent.ball.X Local $y = $this.parent.ball.Y Local $dx = $this.parent.ball.dx Local $dy = $this.parent.ball.dy Local $Width = $this.parent.iWidth Local $Height = $this.parent.iHeight Local $BallSize = $this.parent.ball.size If $y + $dy >= ($Height - 40) And $x + $BallSize >= $this.parent.paddle.X And $x <= $this.parent.paddle.X + $this.parent.paddle.size Then $dy *= -1 EndIf If $y + $dy <= 0 Then $dy = Abs($dy) EndIf If $y + $dy >= $Height - $BallSize Then MsgBox(0, "Game Over", "You missed the ball! Game Over!") Exit EndIf If $x + $dx <= 0 Then $dx = Abs($dx) EndIf If $x + $dx >= $Width - $BallSize Then $dx = -Abs($dx) EndIf $x += $dx $y += $dy $this.parent.ball.dx = $dx $this.parent.ball.dy = $dy $this.parent.ball.X = $x $this.parent.ball.Y = $y $this.parent.drawStage() EndFunc ;==>_move Func _drawStage($this) Local $hGraphics = $this.parent.map[0] Local $hBitmap = $this.parent.map[1] Local $hGraphicsCtxt = $this.parent.map[2] Local $iX = $this.parent.ball.X Local $iY = $this.parent.ball.Y Local $iRadius = $this.parent.ball.size Local $padX = $this.parent.paddle.X Local $padH = $this.parent.iHeight - 40 _GDIPlus_GraphicsClear($hGraphicsCtxt, 0xFF000000) _GDIPlus_GraphicsFillEllipse($hGraphicsCtxt, $iX - $iRadius, $iY - $iRadius, $iRadius * 2, $iRadius * 2, $this.parent.map[3]) _GDIPlus_GraphicsFillRect($hGraphicsCtxt, $padX, $padH, $this.parent.paddle.size, 10, $this.parent.map[4]) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $this.parent.iWidth, $this.parent.iHeight) EndFunc ;==>_drawStage Func _cleanUpResources($this) ConsoleWrite("clean up ressources...." & @CRLF) Local $map = $this.parent.map _GDIPlus_GraphicsDispose($map[0]) _GDIPlus_BitmapDispose($map[1]) _GDIPlus_GraphicsDispose($map[2]) _GDIPlus_BrushDispose($map[3]) $this.parent.map = 0 _GDIPlus_Shutdown() EndFunc ;==>_cleanUpResources Func _runGameLoop($this) Local $speedUpTime = 5000 Local $lastMoveTime = TimerInit() Local $maxX = $this.parent.iWidth While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop If _IsPressed(25) Then $this.parent.paddle.moveLeft() If _IsPressed(27) Then $this.parent.paddle.moveRight($maxX) If _IsPressed(53) Then While 1 If _IsPressed(25) Or _IsPressed(27) Then ExitLoop Sleep(100) WEnd EndIf If TimerDiff($lastMoveTime) >= $speedUpTime Then $this.parent.speedLevel -= 5 If $this.parent.speedLevel < 0 Then $this.parent.speedLevel = 0 $lastMoveTime = TimerInit() EndIf $this.parent.move() Sleep($this.parent.speedLevel) WEnd EndFunc ;==>_runGameLoop Func _ErrFunc($oError) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc ;================================================ Global $game = GamePanel() $game.runGameLoop() ConsoleWrite("------> the end <-------" & @CRLF) ; $game = 0 ;=================================================