Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/20/2024 in all areas

  1. genius257

    Class syntax in AutoIt

    I've made a transpiler for converting AutoIt-like class syntax into AutoIt code. GIthub: https://github.com/genius257/au3class/ Example for the syntax: #include-once Class Example $property = Null Func __construct($ts = 'now') $this.property = 0 EndFunc Func __destruct() ; Destructor code here. EndFunc Func method() Return "something" EndFunc Get Func dynamic() Return $this.dynamic & $this.property EndFunc Set Func dynamic($value) $this.property += 1 $this.dynamic = $value EndFunc EndClass $oExample = Example() $oExample.dynamic = 12 MsgBox(0, "", $oExample.dynamic) MsgBox(0, "", $oExample.method()) $oExample = Null class properties are defined as variables within the Class structure class methods are defined as function declarations within the Class structure property getters and setters need to have Get or Set in front of their function declaration Getter and setter can access their own underlying property, without triggering the getter or setter for said variable. Version 2 produces more code than version 1, but does not need any other scripts included to work. Version 2 is also faster than version 1, since version 2 creates specific code for looking up class members, instead of relying on AutoItObject_Internal with it's dynamic properties lookup. See the example folder on Github for building and using this: https://github.com/genius257/au3class/tree/master/Example
    3 points
  2. [NEW RELEASE] - 11 Jan 15 Added: A new function (_GUITreeViewEx_SaveTV) to save the current TreeView (and checkbox state). Changed: A number of function names have been altered to reflect that at present the UDF is mainly oriented towards checkbox management (but stick around... ). This is script breaking so please do look at the new names if you have already used the UDF in a script. New zip below. A recent thread dealt with getting TreeViews with checkboxes to automatically check/clear associated items when a checkbox was actioned. It seemed like a good idea for a UDF and so here it is. I think the examples are pretty self-explanatory: initialise a TreeView once it is filled, register the UDF NOTIFY handler and then check/clear some checkboxes! Additional functionalities are the ability to check/clear ALL checkboxes in the TreeView and to stop the UDF acting on a previously initialised TreeView. There are also functions to fill/save a TreeView using a text string to define the item titles and the levels at which they should be created which has no link to the other UDF functions but seemeduseful to add. Here is a zip containing the UDF and examples in both MessageLoop & OnEvent mode: GUITreeViewEx.zip As always, comments, compliments and criticisms welcomed. M23
    1 point
  3. Hi @Gianni You are right, that is indeed an oversight, thanks for telling me The issue has been fixed on the master branch now, but I'll wait a day or two before creating a new release, to verify no more small mistakes appear
    1 point
  4. Thanks a lot. Work fine! best regards
    1 point
  5. another approach ; https://www.autoitscript.com/forum/topic/211902-code-to-obtain-only-the-first-file-of-the-a-lot-of-folders/ #include <File.au3> _FindAllDir(@MyDocumentsDir) ;---------------------------------------------------------------------------------------- Func _FindAllDir($dir) If StringRight($dir, 1) <> "\" Then $dir &= "\" $ArraySrtfiles = _FileListToArrayRec($dir, "*", $FLTAR_FOLDERS, $FLTAR_RECUR) If Not IsArray($ArraySrtfiles) Then ConsoleWrite($dir & " = Invalid input path" & @CRLF) Return Else Local $sResult For $x = 1 To $ArraySrtfiles[0] ;ConsoleWrite($dir & $ArraySrtfiles[$x] & @CRLF) $sResult = _FindAllFile($dir & $ArraySrtfiles[$x], "*.txt") If Not @error Then ConsoleWrite($sResult & @CRLF) Next EndIf EndFunc ;==>_FindAllDir ;---------------------------------------------------------------------------------------- Func _FindAllFile($dir, $FileMask) $ArraySrtfiles = _FileListToArrayRec($dir, $FileMask, $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_SORT) If Not IsArray($ArraySrtfiles) Then Return SetError(1, 0, "") Else Local $sResult For $x = 1 To $ArraySrtfiles[0] $sResult = $dir & $ArraySrtfiles[$x] Return $sResult Next EndIf EndFunc ;==>_FindAllFile ;----------------------------------------------------------------------------------------
    1 point
  6. 1 point
  7. Thanks a lot my friend, with this code i can made my program. best regards
    1 point
  8. 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...
    1 point
  9. 1. Your current way doesn't even work in theory. GUISwitch() needs a control id, and you give it the index. You should have set the advanced parameter of GUICtrlRead(). See GUISwitch(), GUICtrlCreateTabItem() and GUICtrlRead() in the helpfile. 2. Read the page for GUICtrlCreateTabItem() in the helpfile again. Notice the second remark? So to fix you script, change to: GUICtrlCreateTabItem("") GUICtrlSetState($curtab, $GUI_SHOW) GUISetState(@SW_SHOW) And voila!
    1 point
×
×
  • Create New...