Leaderboard
Popular Content
Showing content with the highest reputation on 04/22/2024 in all areas
-
; This works. -> because it's a button, and $BM_SETIMAGE = 0xF7 is ButtonConstants GUICtrlSendMsg ($idButton, $BM_SETIMAGE, $IMAGE_ICON, DllStructGetData ($tResIcons, 1, 297)) GUICtrlCreateLabel ("This works.", 50, 100) Sleep (1000) ; Does not work. -> because it's not a button, -> $STM_SETIMAGE = 0x0172 is StaticConstants -> Now works GUICtrlSendMsg ($idIcon, $STM_SETIMAGE, $IMAGE_ICON, DllStructGetData ($tResIcons, 1, 297)) GUICtrlCreateLabel ("Now works.", 50, 220) https://learn.microsoft.com/en-us/windows/win32/controls/individual-control-info #include <ButtonConstants.au3> ; C:\Program Files (x86)\AutoIt3\Include\ButtonConstants.au3 #include <StaticConstants.au3> ; C:\Program Files (x86)\AutoIt3\Include\StaticConstants.au32 points
-
This Beta version contains SciTE v 5.4.0 and a major change to the AutoComplete functionality and automatically addition of required #include lines at the top. Many LUA functions are updated. 2023-12-27 13:30 Merged SciTE Release 5.4.0 with the SciTE4AutoIt3 sources Many changes to the new LUA functions 2023-03-10 13:00 Merged SciTE Release 5.3.4 with the SciTE4AutoIt3 sources Added option to jump to the definition of a Variable when Ctrl+J is used with the caret placed with a variable name. Many other small changes... see this thread for details Move the zip into the Beta directory making it for more people available. Move this thread to AutoIt Technical discussions, so others can participate in testing when they want. 2023-03-14 20:00 Merged SciTE Release 5.3.5 with the SciTE4AutoIt3 sources Also show constant includes in #include<... dropdown. Fixed issue with portable directory duplicates due to improper case checking Fixed REGEX getting all possible *.au3 files when Dir returns a Timestamp in format hh:mm AM/PM How to test/install: Backup your current SciTE directory! Download the Beta SciTE4AutoIt3.exe installer or portable zip. Run installer or do your thing with the portable zip. Check below documentation on all possible configuration option via #Directive or in the SciTEUser.properties. Jos ============ Quick feature overview... check this Documentation for all details ======================================== This is how it looks with a basic example: Here I am using @Melba23's ExMsgBox include file which is located in my Private Include directory: This shown you in more details the basics of the changes: The announced change here has grown into a project on it own, which I feel is now at a stage where I could use some help from beta testers trying out these updated. I have created the initial documentation on all updates made and how the added functionality works, which is now part of the Helpfile available: AutoComplete & Dynamic Includes Previous Top Next Overview This LUA script functionality build in the SciTE4AutoIt3 version of SciTE will dynamically add #include statements required for the used UDFs or Global Const Variables. When dynamic.includes=1 you will be able to use Ctrl+Shift+z to process the whole file and scan it for missing Global Const Variables or UDFs. When dynamic.includes.whiletyping=1 is also set, the LUA functionality will add the required #include lines while typing. This only works when dynamic.includes=1. The AutoComplete functionality has also been changed and will now also search for partial matches in the names in stead of "Starting with", so you don't need to know the exact start of the funtion to be able to search for it. Changes to existing features Syntax Coloring All found Func's as defined here, not just the standard ones, will now immediately have their correct Font & formatting as defined for properties Styles 15-17. After you specified a none-standard known UDF, you will see it has Style 17 Color&Formatting when it is an UDF that exists in an Include file specifically for this Script. Selection for #include lines You can now use either < ' " as starting character to trigger the DropdownList with available include files. This list will now include all Standard, User defined and Dynamically found Include files. You can now type any part of the include name, not just the starting letters, to find the Include file you want. For example when you type: #include<apic this will be shown and we just press 2 times the Down key: .. then when you hit the Tab key, this will be the result: Smart AutoComplete function for Variables, Functions and Abbreviations The Dropdown will show al list of possible Variables or Functions and Abbreviation when you start typing. The match is done on the whole functionname now, not just the starting characters. The Starting $ or _ characters are ignored in this search and the results are shown in the order of the starting position in the found "words" of the typed characters: Example 1: When we type Find the below is returned: As you can see they are sorted in the order of starting position of "Find" and then Alphabetically Example 2: When you type $Yes, the result will be: New: How Dynamic #Include line insertion works Example1 When you type the following in your source: _ArrayAdd .. and then when you hit the Opening bracket or space key, the required #include<array.au3> line will be added within the existing or newly created #region: The same will happen when you use one of the Global Const variables from one of the *constants*.au3 includes in the defined include directories. This #region can be moved to any place in the script you prefer and will be used from here on as long as you do not change anything in those 2 #region lines. Any Subsequent added include file will be added to the end of the list with the Date&Time of the addition so you can easily see when/what was added. Example2 This is an Example for an new script in the SciTE_Jump Directory showing the use of the #SciTE4AutoIt3_Dynamic_Include_Path=; directive: The includes for this Utility are located in the Includes subdirectory, so aren't considered unless we specify it as follows: #SciTE4AutoIt3_Dynamic_Include_Path=;Includes; ... and then we start typing the name of one of the UDFs in a include in this directory and hit Tab on the first one shown: When we then hit the Opening bracket or Space key, the required #include"includes\_SciTE.au3" line will be added within the existing or newly created #region: Example3 This is an Example for a Global Const include file addition: We have just typed the last line of this script: .. and hit the Space key, the required #include<MsgBoxConstants.au3> line will be added within the existing #Region above the #EndRegion line: These are all the Func's (UDFs) that will be recognized by the dynamic include process: All Funcs in the default autoit/includes directory with format _ABC(), undocumented Funcs will be added to AutoComplete All Funcs except __*.au3 from all extra *.au3 Files in the openfile= paths that have a #include-once in it, are added to Style 16 (UserUDFs). All Funcs from the current script file are added to style 17 (InFIleUDFs) All Gobal Const Variables defined in any of the previous defined paths that are defined in a *constants*.au3 scriptfile which also includes #include-once. All Funcs except __*.au3 from all *.au3 Files in the current script directory are added to Style 16 (UserUDFs). All Funcs except __*.au3 from all *.au3 Files in the directories defined with Directive:#SciTE4AutoIt3_Dynamic_Include_Path=;Includes\relative\path;d;\includes\absolute\path Items 1-4 are read from those directories one time during the life of SciTE, but only when the first *.au3 files is opened. (slows it down ~0.5 sec one time to build all required tables) Items 5-6 are read each time an *au3 file is Opened or Switched to its Tab. (slows it down ~0.1 - 0.2 secs per change of tab and at Save time, to build all required current file tables) Configuration options for AutoComplete & Dynamic Includes This is the section in au3.properties where the autocomplete & dynamic includes config is defined. You can copy any of these lines into your SciTEUser.properties: ## ------------------------------------------------------------------------------------------------------------------------ ## dynamic.include Directives and properties reference ## ----------------------------------------------------- #SciTE4AutoIt3_Dynamic_Include=y ;dynamic.include=y/n #SciTE4AutoIt3_Dynamic_Include_whiletyping=y ;dynamic.include.whiletyping=y/n #SciTE4AutoIt3_Dynamic_Include_recursive_check=n ;dynamic.include.recursive.check=n/y #SciTE4AutoIt3_Dynamic_Include_use_local_cache=n ;dynamic.include.use.local.cache=n/y #SciTE4AutoIt3_Dynamic_Include_version=prod ;dynamic.include.version=prod/beta #SciTE4AutoIt3_Dynamic_Include_verboselevel=0 ;dynamic.include.verbose.level=0/1/2 #SciTE4AutoIt3_Dynamic_Include_Path= #SciTE4AutoIt3_AutoItDynamicIncludes_debug=n ;debug.autoitdynamicincludes=n/y #SciTE4AutoIt3_AutoItAutocomplete_debug=n ;debug.autoitautocomplet=n/y #SciTE4AutoIt3_AutoItGotoDefinition_debug=n ;debug.autoitgotodefinition=n/y #SciTE4AutoIt3_AutoItTools_debug=n ;debug.autoIttools=n/y ## ================================================ ## dynamic.include config ## ================================================ #> dynamic.include=y/n n=disabled y=will automatically build the func tables for coloring and autocomplete (requires restart SciTE!) dynamic.include=y #> whiletyping=y/n n=disabled y=will automatically add any required standard or USERincludefile for the current line, on the fly, when ) or enter ispressed !) dynamic.include.whiletyping=y #> use.local.cache=n/y n=disable y=Use cache file for local Include UDFs and VARs which could increase the speed when you have a lot of local includefiles which normally shouldn't be the case dynamic.include.use.local.cache=n #> version prod=Use AutoIt3 Production version beta=Use AutoIt3 Beta version dynamic.include.version=prod #> recursive.check=n/y n=disable y=When you like to only add an Include when it isn't included through another #included file yet. dynamic.include.recursive.check=n # level of debug messages 0/1/2 0=disabled; 1= Warnings & Timing per Function; 2=1+Total timing dynamic.include.verbose.level=0 #> Max number of includes files to read from the user directories in the list. This doesn't including the standard AutoIt3 includes. dynamic.max.includes=150 #> Max number total UDFs in the Userlist to handle by dynamic includes. This doesn't including the standard AutoIt3 includes-UDFs. dynamic.max.funcs=3000 #> Scriptlines longer that this value won't be looked at for Checking for required #Include statements. dynamic.max.line.length=300 ## ================================================ ## Autocomplete and call tip settings ## ================================================ autocomplete.au3.disable=0 autocomplete.au3.ignorecase=1 # Define minimum length before AutoComplete dropdown is shown- default=2 autocomplete.au3.min.length=2 # Include Abbrevs in AutoComplete dropdown (default=1/y) autocomplete.au3.include_abbrevs=1 # Don't show AutoItComplete with these styles (Internal only in SciTE4AutoIt3) autocomplete.ignore.styles.$(au3)=1;2;3;6;7;10;13 # Define which character will be added after Tab or Enter was entered and not on a Function/UDF: Can be \s \t \n for space;tab;newline autocomplete.au3.on.enter=\n autocomplete.au3.on.tab= # List of all AutoComplete API files used api.$(au3)=$(SciteDefaultHome)\api\au3.api;$(SciteDefaultHome)\api\au3.autoit3wrapper.api;$(SciteUserHome)\au3.std.dynamic.calltips.api;$(SciteUserHome)\au3.file.dynamic.calltips.api;$(SciteUserHome)\au3.usr.dynamic.calltips.api;$(SciteUserHome)\au3.user.calltips.api ## ================================================ ## Separate settings for debugging these Lua files ## ================================================ #> Enable debugging for these lua scripts: debug.autoitdynamicincludes=n debug.autoitautocomplete=n debug.autoitgotodefinition=n debug.autoitindentfix=n debug.autoittools=n #> when debug.tofile is defined, log records will be send to the log in stead of OutputPane: debug.tofile=$(SciteUserHome)\SciTE_LUA_Scripts_Debug.err # ------------------------------------------------------------------------------------------------------------------------1 point
-
Description: This implementation of a Ping Pong game in AutoIt highlights the powerful features of AutoItObject.au3 for object-oriented programming. Key Features: Object-Oriented Programming: AutoItObject.au3 enables the creation of classes, objects, properties, and methods, providing a more structured and modular approach to game development, such as Ping Pong. Encapsulation and Modularity: Game entities like the ball (Ball) and paddle (Paddle) are encapsulated within objects, enhancing code organization and making it easier to maintain and extend. Code Reusability: Methods and objects defined with AutoItObject can be reused across different parts of the game, promoting better code reusability and management of common functionalities. Improved Error Handling: AutoItObject simplifies error management by allowing the definition of custom error handlers, ensuring better robustness and reliability of the game. Extending AutoIt's Capabilities: By adding object-oriented programming to AutoIt, AutoItObject extends the language's capabilities, enabling the creation of more complex and sophisticated applications like this Ping Pong game. By leveraging AutoItObject.au3, this Ping Pong game offers a smoother development experience and better code organization, making it a compelling example of using AutoIt's advanced features to create interactive games and applications. Furthermore, AutoItObject extends the capabilities of AutoIt, allowing developers to create interactive games and applications with greater ease and efficiency. The Ping Pong game serves as a testament to the potential of AutoItObject in enhancing the development experience and enabling the creation of more robust and scalable software solutions. Overall, the Ping Pong game exemplifies how AutoItObject empowers developers to leverage object-oriented programming paradigms within the AutoIt scripting language, opening up new possibilities for building innovative and engaging applications. #include-once #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #INDEX# ======================================================================================================================= ; Title .........: Ping Pong Game ; AutoIt Version : 3.3 ; AutoItObject Version : v1.2.8.2 ; Language ......: English ; Description ...: This script implements a simple Ping Pong game using AutoIt->AutoItObject.au3. ; Dependencies ..: AutoItObject.au3, GDIPlus.au3 ; Author ........: Numeric ; =============================================================================================================================== ; 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 <Misc.au3> Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _GDIPlus_Startup() _AutoItObject_Startup() Const $COLOR_RED = 0xFFFF0000 Const $COLOR_GREEN = 0xFF00FF00 Func Ball($x = 0, $y = 0, $size = 5) Local $cBall = _AutoItObject_Class() With $cBall .Create() .AddProperty("dx", $ELSCOPE_PUBLIC, 10) .AddProperty("dy", $ELSCOPE_PUBLIC, -10) .AddProperty("size", $ELSCOPE_PUBLIC, $size) .AddProperty("X", $ELSCOPE_PUBLIC, $x) .AddProperty("Y", $ELSCOPE_PUBLIC, $y) .AddMethod("move", "_move") EndWith Return $cBall.Object EndFunc ;==>Ball Func Paddle($x = 0, $size = 5) Local $cPaddle = _AutoItObject_Class() With $cPaddle .Create() .AddProperty("X", $ELSCOPE_PUBLIC, $x) .AddProperty("size", $ELSCOPE_PUBLIC, $size) .AddProperty("dx", $ELSCOPE_PUBLIC, 20) .AddMethod("moveLeft", "_moveLeft") .AddMethod("moveRight", "_moveRight") EndWith Return $cPaddle.Object EndFunc ;==>Paddle Func _moveLeft($this) $this.X -= $this.dx If $this.X < 0 Then $this.X = 0 EndFunc ;==>_moveLeft Func _moveRight($this, $maxX) Local $paddleWidth = $this.size If $this.X + $this.dx + $paddleWidth <= $maxX Then $this.X += $this.dx Else $this.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 = _AutoItObject_Class() With $cGamePanel .Create() .AddProperty("iWidth", $ELSCOPE_PUBLIC, $iWidth) .AddProperty("iHeight", $ELSCOPE_PUBLIC, $iHeight) .AddProperty("ball", $ELSCOPE_PUBLIC, $Ball) .AddProperty("paddle", $ELSCOPE_PUBLIC, $paddleX) .AddProperty("map", $ELSCOPE_PUBLIC, $aGDIMap) .AddProperty("speedLevel", $ELSCOPE_PUBLIC, 100) .AddMethod("move", "_move") .AddMethod("drawStage", "_drawStage") .AddMethod("cleanUpResources", "_cleanUpResources") .AddDestructor("_cleanUpResources") .AddMethod("runGameLoop", "_runGameLoop") EndWith Return $cGamePanel.Object EndFunc ;==>GamePanel Func _move($this) Local $x = $this.ball.X Local $y = $this.ball.Y Local $dx = $this.ball.dx Local $dy = $this.ball.dy Local $Width = $this.iWidth Local $Height = $this.iHeight Local $BallSize = $this.ball.size If $y + $dy >= ($Height - 40) And $x + $BallSize >= $this.paddle.X And $x <= $this.paddle.X + $this.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.ball.dx = $dx $this.ball.dy = $dy $this.ball.X = $x $this.ball.Y = $y $this.drawStage() EndFunc ;==>_move Func _drawStage($this) Local $hGraphics = $this.map[0] Local $hBitmap = $this.map[1] Local $hGraphicsCtxt = $this.map[2] Local $iX = $this.ball.X Local $iY = $this.ball.Y Local $iRadius = $this.ball.size Local $padX = $this.paddle.X Local $padH = $this.iHeight - 40 _GDIPlus_GraphicsClear($hGraphicsCtxt, 0xFF000000) _GDIPlus_GraphicsFillEllipse($hGraphicsCtxt, $iX - $iRadius, $iY - $iRadius, $iRadius * 2, $iRadius * 2, $this.map[3]) _GDIPlus_GraphicsFillRect($hGraphicsCtxt, $padX, $padH, $this.paddle.size, 10, $this.map[4]) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $this.iWidth, $this.iHeight) EndFunc ;==>_drawStage Func _cleanUpResources($this) ConsoleWrite("clean up ressources...." & @CRLF) Local $map = $this.map _GDIPlus_GraphicsDispose($map[0]) _GDIPlus_BitmapDispose($map[1]) _GDIPlus_GraphicsDispose($map[2]) _GDIPlus_BrushDispose($map[3]) $this.map = 0 _GDIPlus_Shutdown() _AutoItObject_Shutdown() EndFunc ;==>_cleanUpResources Func _runGameLoop($this) Local $speedUpTime = 5000 Local $lastMoveTime = TimerInit() Local $maxX = $this.iWidth While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop If _IsPressed(25) Then $this.paddle.moveLeft() If _IsPressed(27) Then $this.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.speedLevel -= 5 If $this.speedLevel < 0 Then $this.speedLevel = 0 $lastMoveTime = TimerInit() EndIf $this.move() Sleep($this.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() $game = 0 ;=================================================1 point
-
Streamlined : #include "C:\Apps\AutoIt\JSON\json.au3" #include <Array.au3> $object = json_decode(FileRead("Test.json")) ;for local testing $Coins = json_get($object, '.data') Local $Chart[UBound($Coins)][2] for $i = 0 to UBound($Coins) -1 $Chart[$i][0] = json_get($object, '.data[' & $i & '].name' ) $Chart[$i][1] = Number(json_get($object, '.data[' & $i & '].quote.USD.percent_change_1h'), 3) Next _ArraySort($Chart, 3, Default, Default, 1) _ArrayDisplay($Chart)1 point
-
I see. Then I suggest: Global $iRow ; Loop starts here $iRow = _ArrayAdd($Chart,$name) $Chart[$iRow][1] = number($change_1h,3)1 point
-
#include "json.au3" #include <Array.au3> Dim $Chart[0][5] ; Array size of 2 columns $object = json_decode(FileRead("Test.json")) ;for local testing $Coins = json_get($object, '.data') for $i = 0 to UBound($Coins) -1 $name = json_get($object, '.data[' & $i & '].name' ) $change_1h = json_get($object, '.data[' & $i & '].quote.USD.percent_change_1h') _ArrayAdd($Chart,$name & "|" & number($change_1h,3) ) $Chart[$i][2] = VarGetType ( $Chart[$i][1] ) $Chart[$i][3] = number($change_1h,3) $Chart[$i][4] = VarGetType ( $Chart[$i][3] ) Next _ArraySort($Chart, 1, Default, Default, 3) _ArrayDisplay($Chart)1 point
-
This code returns a String as AutoIt internally converts your number to a String again to be able to concatenate them. $name & "|" & number($change_1h,3) Call _ArrayAdd twice to fill the two columns. See the help file for details: "String datatype elements are sorted alphabetically and number datatype elements are sorted numerically - it is important to ensure that elements are of the correct datatype before sorting."1 point
-
It does work for me....Win101 point
-
I'd like to take a look, but please provide a running reproducer with includes and a sample mp3 you have problems with.1 point
-
Maybe there is a better way, but this is working for me : GUICtrlDelete($idIcon) Sleep(20) $idIcon = GUICtrlCreateIcon ("", 2, 50, 170, 45, 45) Local $hDC = _WinAPI_GetDC(GUICtrlGetHandle($idIcon)) _WinAPI_DrawIcon($hDC, 0, 0, DllStructGetData ($tResIcons, 1, 297)) GUICtrlCreateLabel ("This now works.", 50, 220)1 point
-
Function hints in SciTe for user functions (like intellisense)
SkysLastChance reacted to Jos for a topic
The version I am working on will. It will dynamiccally add funcs from the current script when you save it. No firm eta yet. At this moment you can only statically add your own funcs as described in the helpfile that comes with the current full version of scite4autoit3.1 point -
Extra resource Fields in ckeditor As Autoit code
ioa747 reacted to argumentum for a topic
Try "https://...". By enclosing it I believe that would not happen ( just guessing, haven't tried/looked/tested anything )0 points