Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/19/2017 in all areas

  1. I had a look at your request and came up with (I hope) a simple approach for this. The replace of @ ScriptLineNumber remains the same for the #include files, but for the master script it will replace it by: "XXX/YYY" where XXX is the master script linenumber, YYY is the Merged script linenumber. au3stripper v 17.224.935.2 is available in the Beta directory for testing. What do you think? Jos
    2 points
  2. This method converts a[.b[.c[.d]]]] to 00a[00b[00c[00d]]]] (Where abcd are digits.) by executing a string from a StringRegExpReplace function. It works on a 1D or 2D array. #include <Array.au3> Local $aVersionsAndReleases[6][2] = [["0.2.8.9", "Release #2"], ["0.2.9.10", "Release #1"], ["0.2.8", "Release #1"], _ ["0.2.7.10", "Release #1"], ["0.2.9.11", "Release #2"], ["0.3", "Release #1"]] ; Or try ;Local $aVersionsAndReleases[6] = ["0.2.8.9", "0.2.9.10", "0.2.8", "0.2.7.10", "0.2.9.11", "0.3"] ; 1D array _ArrayColInsert($aVersionsAndReleases, 0) ; Add a new column, Col 0. For $x = 0 To UBound($aVersionsAndReleases) - 1 $aVersionsAndReleases[$x][0] = Execute(StringTrimRight(StringRegExpReplace($aVersionsAndReleases[$x][1], "(\d+)\.?", _ 'StringRight("000${1}", 3) & '), 3)) ; Converts a[.b[.c[.d]]]] to 00a[00b[00c[00d]]]] Where abcd are digits. ;ConsoleWrite(StringRegExpReplace($aVersionsAndReleases[$x][1], "(\d+)\.?", 'StringRight("000${1}", 3) & ') & @CRLF) Next _ArraySort($aVersionsAndReleases, 1, 0, 0, 0) ConsoleWrite(_ArrayToString($aVersionsAndReleases, ' - ')) _ArrayColDelete($aVersionsAndReleases, 0, True) ; Now delete the added column. _ArrayDisplay($aVersionsAndReleases)
    2 points
  3. [New Version] - 16 Apr 2022 Added: A new function _GUIExtender_Hidden_Control which allows you to specify which controls should not be automatically reshown when it redraws the GUI. You no longer need to hide/show the control within the script - this function does that as well as telling the UDF whether or not to show it on redraw. New UDF and an additional example in the zip below. Previous changes: Changelog.txt ........................................................................... The GUIExtender UDF allows you to have multiple sections within your GUIs which can be either static or extendable. The extendable sections can be extended and retracted either by UDF created buttons or programmatically by other controls or HotKeys. The controls on the sections are fully functional and there is no overlap problem when retracted (see the details section if you want to know how). The UDF can be used in both MessageLoop and OnEvent modes and with both native and UDF created controls, as well as embedded objects and child GUIs. -------------------------------------------------------------- Note: This is a new recoded and (I hope) simplified version of my earlier UDF of the same name. If you move to this new version there are several script-breaking changes, so please look carefully at the included example scripts to see where things have changed. Here is a quick guide to how the UDF function list has been altered: Old function New function Comment _Init _Init Unchanged _Clear _Clear Unchanged _Section_Start _Section_Create New default parameters for position and size _Section_End Deprecated _Section_Create used to end all section creation _Section_Action _Section_Activate Simple rename _Action _EventMonitor Simple rename _Section_Extend _Section_Action Simple rename, but now uses integer parameter for required state _Section_State _Section_State Unchanged _Restore Deprecated Now automatic _ActionCheck Deprecated Now automatic _HandleCheck Deprecated Now automatic _Obj_Data _Obj_Data Unchanged - _Handle_Data Single call on creation replaces multiple _HandleCheck calls Note: The _EventMonitor function must be added to the idle loop for the automatic actions above to occur -------------------------------------------------------------- Details of how the UDF works for those who are interested: The UDF and plenty of commented examples are in the attached zip: GUIExtender.zip M23
    1 point
  4. aleeksunder

    GetWildPath Function

    Hello! I've just finished a function and decided to share it. Maybe you know some better alternatives or can give some advices to optimize it, since finally it completely blows up my brain Function retruns array of paths that match the entire pattern. You pattern can be wild as you wish. Usage: ; Get <any files and folders that matches *.exe> inside <anydrive> \ <anyfolder that match 'W*nd*s'> \ <anyfolder that match 'Sys'> _ArrayDisplay( GetWildPath( '*:\W*nd*s\Sys*\*.exe' ) ) ; Get <anyfolder that match 'W*nd*s'> inside <anydrive> _ArrayDisplay( GetWildPath( '*:\Wind*s' , $FLTA_FOLDERS ) ) ; If pattern begins with '\' function interprets it as _root_ of a working directory's drive or directory passed as 3rd paramter _ArrayDisplay( GetWildPath( '\*Te*\*34.*t*t*' , $FLTA_FOLDERS ) ) ; If pattern not begins with '\' function interprets it as relative path to working directory or directory passed as 3rd paramter _ArrayDisplay( GetWildPath( '*Te*\*3*.*t*' , $FLTA_FILESFOLDERS , 'D:\' ) ) Function itself, maybe a bit hard-coded but as is: #include-once #include <script\autoit\AutoItConstants.au3> #include <script\autoit\StringConstants.au3> #include <script\autoit\File.au3> #include <script\autoit\Array.au3> Func GetWildPath( $s_pattern , $i_flag = $FLTA_FILESFOLDERS , $s_working_directory = @WorkingDir ) $s_working_directory = StringRegExpReplace( $s_working_directory , '[\\/]+$' , '' ) Local $a_split = StringSplit( $s_pattern , ':' ) If Not @error Then $s_drive = $a_split[1] $s_path = $a_split[2] Else $s_drive = StringSplit( $s_working_directory , ':' )[1] $s_path = $a_split[1] EndIf If $s_drive = '*' Then Local $a_drives = DriveGetDrive( $DT_ALL ) Else Local $a_drives[1] $a_drives[0] = _ArrayAdd( $a_drives , $s_drive & ':' ) EndIf Local $a_result = [] For $i_drive = 1 To $a_drives[0] If StringLeft( $s_path , 1 ) = '\' Or StringLeft( $s_path , 1 ) = '/' Then $s_path_root = StringUpper( $a_drives[ $i_drive ] ) & '\' $s_path_relative = StringTrimLeft( $s_path , 1 ) Else $s_path_root = StringUpper( $a_drives[ $i_drive ] ) & StringSplit( $s_working_directory , ':' )[2] $s_path_relative = $s_path EndIf Local $a_path = StringSplit( $s_path_relative , '\/' ) Local $a_final = [] If $a_path[ 0 ] > 1 Then Local $a_relative = _FileListToArray( $s_path_root , $a_path[ 1 ] , $FLTA_FOLDERS , True ) If Not @error Then For $i_path = 2 To $a_path[ 0 ] If $i_path < $a_path[ 0 ] Then Local $a_relative_result = [] For $i_relative = 1 To $a_relative[ 0 ] Local $a = _FileListToArray( $a_relative[ $i_relative ] , $a_path[ $i_path ] , $FLTA_FOLDERS , True ) If Not @error Then _ArrayConcatenate( $a_relative_result , $a , 1 ) EndIf Next $a_relative_result[0] = UBound( $a_relative_result ) - 1 $a_relative = $a_relative_result Else For $i_relative = 1 To $a_relative[0] Local $a = _FileListToArray( $a_relative[ $i_relative ] , $a_path[ $i_path ] , $i_flag , True ) If Not @error Then _ArrayConcatenate( $a_final , $a , 1 ) EndIf Next $a_final[0] = UBound( $a_final ) - 1 EndIf Next EndIf Else Local $a_final = _FileListToArray( $s_path_root , $a_path[ 1 ] , $i_flag , True ) EndIf _ArrayConcatenate( $a_result , $a_final , 1 ) $a_result[0] = UBound( $a_result ) - 1 Next Return $a_result EndFunc Since I'm new to AutoIt all of your comments and ideas are welcome
    1 point
  5. You do realize this is a 7 year old post? To get FileList with FileTime you could use: #include <Array.au3> #include <File.au3> Local $sFilePath = @ScriptDir Local $aFilePath = _FileListToArrayRec($sFilePath, "*", 1, 0, 0, 2) If @error Then Exit Local $aFileTime[1][2] For $i = 1 To $aFilePath[0] _ArrayAdd($aFileTime, $aFilePath[$i] & "|" & FileGetTime($aFilePath[$i], 0, 1)) Next _ArrayDisplay($aFileTime)
    1 point
  6. Creating an application that could read any autoit code and convert it into efficient C code would be a mammoth undertaking. Whilst it is relatively easy to convert simple statements that use AutoIts built in functions, handling more complex statements and the UDF libraries would be a nightmare. The effort required is just not going to be worth anyone's time. I use AutoIt daily in an enterprise environment and have hundreds of scripts ranging from small 10 liners that I use once to do something like update a 1.5TB xml file to 80,000 line scripts that orchestrates a full testing and validation flow line. As others have said the speed of AutoIt in most day to day use cases is not an issue. If speed is an issue then I would write the application directly in C so that I can make full use of the direct control that C give you rather than some inevitably less than optimal automatically generated code. The main reason I use AutoIt is the speed that I can create an application that does the job require. Usually this is much quicker than I could even just write a detailed requirements document require by our IS department before they will event give a rough quote.
    1 point
  7. The title is not supposed to be visible within the GUI, so that you have more place on your GUI to customize it. However I can add an extra option in the next versions. Make sure you enable the HighDPI support in the Script and compile the script or disable the compatibility scaling for the .exe file of Autoit. This should make it look sharper and not look dimmed. The name already tells it The fullscreen button is supposed to make the GUI get in front of everything on your desktop. Unfortunately MS again changed something with a Windows 10 update and fu**ed it up as the taskbar stays in front now. Many programs don't work in Fullscreen mode anymore since this update. Only popup windows work in fullscreen mode now. I will try to implement a workaround for the next version. Ps.: If you comment out the maximize button, then you also have to comment out the restore button, otherwise it won't work as both belong together. I can't say as i haven't tested it. I also don't know anyone who still uses XP, therefore I never got any reports if it works or not. Hi, yes that doesn't work unfortunately. All i know is that it is probably complicated and requires a lot of time and motivation to get it working with such pictures
    1 point
  8. Thank you! Works like a charm!
    1 point
  9. czardas

    ArrayWorkshop

    I just spotted a bug affecting _ArrayUniqueXD(), introduced in the last updated version. I doubt anyone using the function will have noticed a problem, but it's only a matter of time before such circumstances occur. I have updated the first post to version 1.0.1 (minimal changes). ; ============================================================================================================================== ; Changes between versions 1.0.0 and 1.0.1 ; _ArrayUniqueXD - Bug introduced in version 1.00 [line 447] ExitLoop 5 should have been changed to ExitLoop 9. ; ==============================================================================================================================
    1 point
  10. water

    Naming Excel Sheet

    Set parameter $bForceNew in _Excel_Open to True and the UDF will start an independant new instance which doesn't interfere with an already running instance of Excel.
    1 point
  11. 0x90

    MetroGUI UDF

    Would love to see a `_Metro_InputBox`, so this is my request for adding a `_Metro_InputBox` if possible. Will really appreciate it!
    1 point
  12. czardas

    ArrayWorkshop

    @stealthmsgr Thanks for the . It is my wish that the topic be helpful in understanding multidimensional arrays, and I'm also learning new things as I develop this UDF. There is a good tutorial in the Wikipedia about arrays, and there are many helpful members in The General Help and Support Forum who can answer any questions you might have (equally well as I can). If you don't get an answer for a problem there, then I might not know the answer either, but I will always be happy to help if I can.
    1 point
  13. Hi therealhanuta Could you supply a simple example on how to use your routines, I mean, to open a serial port, set baudrate, read, write and close? I´m asking that as most of the time these are the really needed functions. The good point is to not use any dll.... Thanks Jose
    1 point
  14. MrCreatoR

    _SplashTextEx UDF

    Using parameter as array index is not a good idea. You should check the index better, so this: If $ID > $limit Then MsgBox(4096, "Limit exceeded.", "The maximum number of messages is 10!", 3) should be replaced with something like this: If $ID > $limit Then Return SetError(1, 0, "Limit exceeded.") ;MsgBox(4096, "Limit exceeded.", "The maximum number of messages is 10!", 3) ElseIf $ID < 0 Then Return SetError(2, 0, "Wrong ID.")
    1 point
×
×
  • Create New...