Search the Community
Showing results for tags 'reference'.
Found 2 results
This forum (Au3 Technical) is inhabited by luminaries whose posts frequently demonstrate understanding far beyond my capabilities. For that reason, and at Jon's suggestion, I am reaching out to tap into your wisdom for a project that I have been working on a for a while. I was looking for a way to give back to AutoIt. As a self-taught programmer I have learned an incredible amount from this forum and the help file. It has been very rewarding. Over the course of my personal experiences I have wished, at times, that even though the materials and support are truly incredible - that someone could explain some of the more basic concepts. At the same time, I saw the creation of code.org and I started to think that AutoIt would be a perfect learning tool for people starting out (because of the simplicity, the incredible help file, and the best forum I have ever seen). All of that led to the creation of this text: https://www.autoitscript.com/forum/files/file/351-learn-to-program-using-free-tools-with-autoit/. It is the first draft of a basic introduction to programming using AutoIt. Nobody has reviewed it. Accordingly, I seek the collective constructive feedback of anyone willing to offer opinion as to content, spot any errors, and make any suggestions to improve it. My goal was always to donate it to the AutoIt forum when it was done. I think it could be a good addition to fill the gap for neophytes who may crave to see how everything fits together. The last thought I will leave you with - similar to the first - is that I am not the world's greatest coder (this may be a case of those who can do and those who can't teach). That said, I am hoping that the issues you will undoubtedly spot are not huge or threatening to the overall effort and that you appreciate the fact that this took some time to pull together. I look forward to hearing your thoughts.
BackRef UDF Working This UDF is made to provide a small interface towards the StringRegExpReplace Autoit function. The extension is very limited but is an easy approach when used properly. Functions User can pass the complete back-reference to a function.The return value from the function is then used to replace the specific group.The final replacement is flexible and the user has full control over it.The final replacement is done automatically till modification isn't required.The optimization is easy and simple.LimitationsThe pattern has to consume the full string.Example Replace the vowels with their ASCII code #include <BackRef.au3> $i_BackRef_Debug = True ;Set Debug to true ; .. Example 1 ============================================================================================================================ ; Replace the vowels with their ASCII code Local $Replaced = RegExBackRef( 'Hello Nice Meeting You', '(.*?)([aeiou])(.*)', "AscW" ) ;The Function is inbuilt If @error Then Exit @error MsgBox ( 64, 'Test', $Replaced ) ; ............ ============================================================================================================================ Make the first Number group equal to second number group if its greater than that ; .. Example 2 ============================================================================================================================ ; The Function replaces the first group with third group if its greater than that Local $Replaced = RegExBackRef( '1223 MaxRange : 150', '(\d+)([^:]+:\h+)(\d+)', "SetMaxRange", '\1:\3', "$v & '\2\3'" ) If @error Then Exit @error MsgBox ( 64, 'Test', $Replaced ) ; The User Defined Function Func SetMaxRange( $iString ) $iString = StringSplit( $iString, ':' , 2) $iString = Int ( $iString  ) $iString = Int ( $iString  ) If $iString > $iString Then Return $iString Return $iString EndFunc ; ............ ============================================================================================================================ The Function replaces unicode chars with ascii alphabet ; .. Example 3 ============================================================================================================================ ; The Function replaces unicode version with ascii alphabet Local $String = 'Déjà' Local $Replaced While 1 $Replaced = RegExBackRef($String, '(.*?)([àâäéèêë])(.*)', "ReplaceFunc") If $Replaced = -1 Or @error Then ExitLoop $String = $Replaced WEnd MsgBox(64, 'Test', $String) Func ReplaceFunc($sMatch) Switch $sMatch Case "é","è","ê","ë" Return "e" Case "à","â","ä" Return "a" EndSwitch EndFunc ;==>ReplaceFunc ; ............ ============================================================================================================================ Convert the unicode lower-case chars to upper-case ; .. Example 4 ============================================================================================================================ ;Convert these chars to upper-case Local $String = "à æ û ü" MsgBox(64, 'Test', GlobalBackRef($String, '(.*?)([\340-\374])(.*)', "ReplaceUniChar")) Func ReplaceUniChar($sMatch) ;Get the ASCII code of the string $iAscW = AscW($sMatch) ;Return the character preceding the current character by 32 Return ChrW($iAscW - 32) EndFunc ;==>ReplaceUniChar ; ............ ============================================================================================================================ ChangeLog v1.0 -First Release v1.1 -Added Debugging features -Added Global Replacement v1.2 -Added Count parameter v1.3 -Now supports formatting control like \r \n and \t in the replace sequence. Download - UDF(v1.3) Here is the UDF to download in the following 7zip file. Please post comments and do give me feedback for improvements and bugs. v1.3 BackRef(UDF).7z Previous Downloads : 44 Regards Phoenix XL