Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/07/2021 in all areas

  1. Done! I have posted the latest version of the CHM file in post #1. Any comments? In the next step I will update the Example code box. Should then work like in the AutoIt help file.
    2 points
  2. Here's how to remove diacritics from accented letters in a Unicode string using a single regex replacement: ; Unicode Normalization Forms Global Enum $UNF_NormC = 1, $UNF_NormD, $UNF_NormKC = 5, $UNF_NormKD Func _Unaccent($s, $iMode = 0) Local Static $aPat = [ _ "(*UCP)[\x{300}-\x{36F}`'¨^¸¯]", _ ; $iMode = 0 : remove combining accents only "(*UCP)\p{Mn}|\p{Lm}|\p{Sk}" _ ; $iMode = 1 : " " " and modifying letters ] Return StringRegExpReplace(_UNF_Change($s, $UNF_NormD), $aPat[Mod($iMode, 2)], "") EndFunc ;==>_Unaccent ; change UNF (Unicode Normalization Form) Func _UNF_Change($sIn, $iForm) If $iForm = $UNF_NormC Or $iForm = $UNF_NormD Or $iForm = $UNF_NormKC Or $iForm = $UNF_NormKD Then Local $aRet = DllCall("Normaliz.dll", "int", "NormalizeString", "int", $iForm, "wstr", $sIn, "int", -1, "ptr", 0, "int", 0) Local $tOut = DllStructCreate("wchar[" & 2 * ($aRet[0] + 20) & "]") $aRet = DllCall("Normaliz.dll", "int", "NormalizeString", "int", $iForm, "wstr", $sIn, "int", -1, "ptr", DllStructGetPtr($tOut, 1), "int", 2 * ($aRet[0] + 20)) Return DllStructGetData($tOut, 1) Else SetError(1, 0, $sIn) EndIf EndFunc ;==>_UNF_Change However Turkish dotless "i" is not an accented letter and needs to be dealt with explicitely. So: Local $s = "ğĞçÇşŞüÜöÖıİ ЁЃЌЍӁ" ; also works for other scripts like cyrillic, etc. Local $sUnTurkished = _Unaccent(StringReplace($s, "ı", "i"))
    2 points
  3. BugFix version - 27 Dec 23 Fixed: No default value set for the MaxWidth parameter - took 12 years for someone to notice it! New UDF and new examples below and in zip. I just realised that although I have posted versions of this UDF many times in Help topics, I had never actually posted a "final" version here in Example scripts - better late than never, I suppose! StringSize takes a text string and calculates the size of label required to hold it as well as formatting the string to fit. Now AutoIt will, of course, size a label automatically to fit a text string, but it will not format the string in any way - what you use as the string is what you get in the label. If you do set any label sizes the text will be wrapped, but you can only determine the correct size of the label by trial and error. StringSize will, however, reformat the string to fit in a given width and tell you the required height so that you can read it all - whatever the font type or size - and you do not have to do the formatting beforehand. Here is a simple example to show what I mean (you need the UDF in the same folder for all the examples): And here is an example showing how StringSize can deal with different fonts and text sizes: You can see that the GUI is perfectly sized each time and that the button is always the right size and in the right place. StringSize returns an array which contains the formatted text to display and the size of the label needed to display it. All you need to do is to use the array elements when you create your label. Try changing the values in $aFont and $aSize if you want to try you own favourites - but beware, StringSize will return an error if you make the size so large that it cannot fit a word into the label width. NEW A more complex example showing how formatted and unformatted text can be sized correctly. The width of GUI holding the unformatted text varies randomly in width (the current value is displayed at top right): NEW And a final example showing how you can get your text in the largest possible font to fit in a given space: Finally here is the UDF itself: And all 5 files in zip format: StringSize.zip I hope you find this useful - I certainly do. M23
    1 point
  4. I updated the log file and added a system reboot at 1am each morning. The original system would reboot if VLC crashed, but I was still getting an occasional system problem (touchscreen going black even though the system had constant power and was set to never blank the screen or go to sleep). I added a reboot at 1am (with notes left in the log file) to try to catch any remaining hardware and software problems. BigPause-206-m3u.au3
    1 point
  5. AD.CHM can now be started directly without any problems (no more 'unblocking' required). ==> OK "Copy to Clipboard" and copying examples via CTRL-C/-V ==> OK "Open this Script" operates as expected ==> OK Clicking on standard commands within the examples displays the respective AutoIt-Help. ==> OK The appearance is analogous to the AutoIt-Help. Well done .
    1 point
  6. Done! I have posted the latest version of the CHM file in post #1. Please unpack the ZIP file and the AD CHM file should work like the AutoIt help file "Open this Script" and "Copy to Clipboard have been added. Any comments?
    1 point
  7. I will. As soon as I can remember where I downloaded the tool from 🤔
    1 point
  8. Why have you doubts ? BTW the [^;]* thing is currently useless
    1 point
  9. Not possible with _FileListToArrayRec. You would need to use/create the code to add some checkpoints inside it. For example you could count the number of folders from the starting folder and then calculate the number of folders searched to have a progress percentage.
    1 point
  10. Use a StringRegExp to extract this info from the text : #include <Array.au3> Local $dData = InetRead("https://www.google.com/",1) $sText = BinaryToString($dData) $aInfo = StringRegExp($sText, '<div id="(.*?)">', 3) ;_ArrayDisplay($aInfo) MsgBox(0, "", $aInfo[4])
    1 point
×
×
  • Create New...