Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/03/2020 in all areas

  1. Yeah but if you include greek, cyrillic, you-name-it and (multiplied by) all the possible diacritics and modifiers, you end up with a big fat monster.
    3 points
  2. Replace Foreign or Accented Characters This is something I recently had a need for, due to the third party program Calibre having strict rules about folder etc naming, though it stores the original names in its database. You can run each method with something like this of course. Global $text = "Rosãleê Ündérlæ" $text = ReplaceForeignCharacters($text) MsgBox(0, "Replacement Text", $text) My first approach, was quick and simple, but not very elegant. Func ReplaceForeignCharacters($text) $text = StringReplace($text, "À", "A", 0, 1) $text = StringReplace($text, "Á", "A", 0, 1) $text = StringReplace($text, "Â", "A", 0, 1) $text = StringReplace($text, "Ã", "A", 0, 1) $text = StringReplace($text, "Ä", "A", 0, 1) $text = StringReplace($text, "Å", "A", 0, 1) $text = StringReplace($text, "Æ", "AE", 0, 1) $text = StringReplace($text, "Ç", "C", 0, 1) $text = StringReplace($text, "È", "E", 0, 1) $text = StringReplace($text, "É", "E", 0, 1) $text = StringReplace($text, "Ê", "E", 0, 1) $text = StringReplace($text, "Ë", "E", 0, 1) $text = StringReplace($text, "Ì", "I", 0, 1) $text = StringReplace($text, "Í", "I", 0, 1) $text = StringReplace($text, "Î", "I", 0, 1) $text = StringReplace($text, "Ï", "I", 0, 1) $text = StringReplace($text, "Ð", "D", 0, 1) $text = StringReplace($text, "Ñ", "N", 0, 1) $text = StringReplace($text, "Ò", "O", 0, 1) $text = StringReplace($text, "Ó", "O", 0, 1) $text = StringReplace($text, "Ô", "O", 0, 1) $text = StringReplace($text, "Õ", "O", 0, 1) $text = StringReplace($text, "Ö", "O", 0, 1) $text = StringReplace($text, "×", "x", 0, 1) $text = StringReplace($text, "Ø", "O", 0, 1) $text = StringReplace($text, "Ù", "U", 0, 1) $text = StringReplace($text, "Ú", "U", 0, 1) $text = StringReplace($text, "Û", "U", 0, 1) $text = StringReplace($text, "Ü", "U", 0, 1) $text = StringReplace($text, "Ý", "Y", 0, 1) ;$text = StringReplace($text, "Þ", "", 0, 1) $text = StringReplace($text, "ß", "B", 0, 1) $text = StringReplace($text, "à", "a", 0, 1) $text = StringReplace($text, "á", "a", 0, 1) $text = StringReplace($text, "â", "a", 0, 1) $text = StringReplace($text, "ã", "a", 0, 1) $text = StringReplace($text, "ä", "a", 0, 1) $text = StringReplace($text, "å", "a", 0, 1) $text = StringReplace($text, "æ", "ae", 0, 1) $text = StringReplace($text, "ç", "c", 0, 1) $text = StringReplace($text, "è", "e", 0, 1) $text = StringReplace($text, "é", "e", 0, 1) $text = StringReplace($text, "ê", "e", 0, 1) $text = StringReplace($text, "ë", "e", 0, 1) $text = StringReplace($text, "ì", "i", 0, 1) $text = StringReplace($text, "í", "i", 0, 1) $text = StringReplace($text, "î", "i", 0, 1) $text = StringReplace($text, "ï", "i", 0, 1) $text = StringReplace($text, "ð", "o", 0, 1) $text = StringReplace($text, "ñ", "n", 0, 1) $text = StringReplace($text, "ò", "o", 0, 1) $text = StringReplace($text, "ó", "o", 0, 1) $text = StringReplace($text, "ô", "o", 0, 1) $text = StringReplace($text, "õ", "o", 0, 1) $text = StringReplace($text, "ö", "o", 0, 1) $text = StringReplace($text, "ø", "o", 0, 1) $text = StringReplace($text, "ù", "u", 0, 1) $text = StringReplace($text, "ú", "u", 0, 1) $text = StringReplace($text, "û", "u", 0, 1) $text = StringReplace($text, "ü", "u", 0, 1) $text = StringReplace($text, "ý", "y", 0, 1) ;$text = StringReplace($text, "þ", "", 0, 1) $text = StringReplace($text, "ÿ", "y", 0, 1) Return $text EndFunc ;=> ReplaceForeignCharacters I then later decided, in passing, that I should make it more streamlined, so I started out doing the following, which I have only finished for the sake of this topic. Func ReplaceForeignCharacters($text) Local $char, $let $char = "À" $let = "A" While 1 $text = StringReplace($text, $char, $let, 0, 1) If $char == "À" Then $char = "Á" ElseIf $char == "Á" Then $char = "Â" ElseIf $char == "Â" Then $char = "Ã" ElseIf $char == "Ã" Then $char = "Ä" ElseIf $char == "Ä" Then $char = "Å" ElseIf $char == "Å" Then $char = "Æ" $let = "AE" ElseIf $char == "Æ" Then $char = "Ç" $let = "C" ElseIf $char == "Ç" Then $char = "È" $let = "E" ElseIf $char == "È" Then $char = "É" ElseIf $char == "É" Then $char = "Ê" ElseIf $char == "Ê" Then $char = "Ë" ElseIf $char == "Ë" Then $char = "Ì" $let = "I" ElseIf $char == "Ì" Then $char = "Í" ElseIf $char == "Í" Then $char = "Î" ElseIf $char == "Î" Then $char = "Ï" ElseIf $char == "Ï" Then $char = "Ð" $let = "D" ElseIf $char == "Ð" Then $char = "Ñ" $let = "N" ElseIf $char == "Ñ" Then $char = "Ò" $let = "O" ElseIf $char == "Ò" Then $char = "Ó" ElseIf $char == "Ó" Then $char = "Ô" ElseIf $char == "Ô" Then $char = "Õ" ElseIf $char == "Õ" Then $char = "Ö" ElseIf $char == "Ö" Then $char = "×" $let = "x" ElseIf $char == "×" Then $char = "Ø" $let = "O" ElseIf $char == "Ø" Then $char = "Ù" $let = "U" ElseIf $char == "Ù" Then $char = "Ú" ElseIf $char == "Ú" Then $char = "Û" ElseIf $char == "Û" Then $char = "Ü" ElseIf $char == "Ü" Then $char = "Ý" $let = "Y" ElseIf $char == "Ý" Then $char = "ß" $let = "B" ElseIf $char == "ß" Then $char = "à" $let = "a" ElseIf $char == "à" Then $char = "á" ElseIf $char == "á" Then $char = "â" ElseIf $char == "â" Then $char = "ã" ElseIf $char == "ã" Then $char = "ä" ElseIf $char == "ä" Then $char = "å" ElseIf $char == "å" Then $char = "æ" $let = "ae" ElseIf $char == "æ" Then $char = "ç" $let = "c" ElseIf $char == "ç" Then $char = "è" $let = "e" ElseIf $char == "è" Then $char = "é" ElseIf $char == "é" Then $char = "ê" ElseIf $char == "ê" Then $char = "ë" ElseIf $char == "ë" Then $char = "ì" $let = "i" ElseIf $char == "ì" Then $char = "í" ElseIf $char == "í" Then $char = "î" ElseIf $char == "î" Then $char = "ï" ElseIf $char == "ï" Then $char = "ð" $let = "o" ElseIf $char == "ð" Then $char = "ñ" $let = "n" ElseIf $char == "ñ" Then $char = "ò" $let = "o" ElseIf $char == "ò" Then $char = "ó" ElseIf $char == "ó" Then $char = "ô" ElseIf $char == "ô" Then $char = "õ" ElseIf $char == "õ" Then $char = "ö" ElseIf $char == "ö" Then $char = "ø" ElseIf $char == "ø" Then $char = "ù" $let = "u" ElseIf $char == "ù" Then $char = "ú" ElseIf $char == "ú" Then $char = "û" ElseIf $char == "û" Then $char = "ü" ElseIf $char == "ü" Then $char = "ý" $let = "y" ElseIf $char == "ý" Then $char = "ÿ" ElseIf $char == "ÿ" Then ExitLoop EndIf WEnd Return $text EndFunc ;=> ReplaceForeignCharacters Becoming dissatisfied with that partway through, I then came up with and used the following in my program. Func ReplaceForeignCharacters($text) Local $char, $let, $p, $pair, $pairs $pairs = "À,A|Á,A|Â,A|Ã,A|Ä,A|Å,A|Æ,AE|Ç,C|È,E|É,E|Ê,E|Ë,E|Ì,I|Í,I|Î,I|Ï,I|Ð,D|Ñ,N|Ò,O|Ó,O|Ô,O|Õ,O|Ö,O|×,x|Ø,O|Ù,U|Ú,U|Û,U|Ü,U|Ý,Y|ß,B|" _ & "à,a|á,a|â,a|ã,a|ä,a|å,a|æ,ae|ç,c|è,e|é,e|ê,e|ë,e|ì,i|í,i|î,i|ï,i|ð,o|ñ,n|ò,o|ó,o|ô,o|õ,o|ö,o|ø,o|ù,u|ú,u|û,u|ü,u|ý,y|ÿ,y" $pairs = StringSplit($pairs, "|", 1) For $p = 1 To $pairs[0] $pair = $pairs[$p] $pair = StringSplit($pair, ",", 1) $char = $pair[1] $let = $pair[2] $text = StringReplace($text, $char, $let, 0, 1) Next Return $text EndFunc ;=> ReplaceForeignCharacters I could have refined it further, as I am sure my good buddy @TheDcoder would have done, to avoid repetition of some of the second pair characters, but I was happy enough as is ... and I like a quick easy visual ... play it simple is my mantra. Please feel free to offer alternate solutions, improve upon my code etc. I imagine plenty would come up with a RegEx version, etc.
    3 points
  3. Hello. This is not as fast as jchd's code. But it works. Global Const $g_aChars = [["À", "A"], ["Á", "A"], ["Â", "A"], ["Ã", "A"], ["Ä", "A"], ["Å", "A"], ["Æ", "AE"], ["Ç", "C"], ["È", "E"], ["É", "E"], _ ["Ê", "E"], ["Ë", "E"], ["Ì", "I"], ["Í", "I"], ["Î", "I"], ["Ï", "I"], ["Ð", "D"], ["Ñ", "N"], _ ["Ò", "O"], ["Ó", "O"], ["Ô", "O"], ["Õ", "O"], ["Ö", "O"], ["×", "x"], ["Ø", "O"], ["Ù", "U"], ["Ú", "U"], ["Û", "U"], ["Ü", "U"], ["Ý", "Y"], _ ["ß", "B"], ["à", "a"], ["á", "a"], ["â", "a"], ["ã", "a"], ["ä", "a"], ["å", "a"], ["æ", "ae"], _ ["ç", "c"], ["è", "e"], ["é", "e"], ["ê", "e"], ["ë", "e"], ["ì", "i"], ["í", "i"], ["î", "i"], ["ï", "i"], ["ð", "o"], ["ñ", "n"], ["ò", "o"], _ ["ó", "o"], ["ô", "o"], ["õ", "o"], ["ö", "o"], ["ø", "o"], ["ù", "u"], ["ú", "u"], ["û", "u"], ["ü", "u"], ["ý", "y"], ["ÿ", "y"]] Func ReplaceForeignCharacters($text) For $i = 0 To UBound($g_aChars) - 1 $text = StringReplace($text, $g_aChars[$i][0], $g_aChars[$i][1], 0, 1) Next Return $text EndFunc ;==>ReplaceForeignCharacters Saludos
    2 points
  4. 2 points
  5. willichan

    Barcode Generators

    As I have time, I am converting my old barcode generators from old Pascal source to AutoIt. I will add them all here as I convert them, rather than creating a new topic for each one. There are no global variables involved, so you can safely include any of these without worry about variables being stomped on. No barcode fonts required. Code128Auto - Creates a Code128A/B/C optimized barcode from supplied data Code39 - Creates a Code39 or Code39Extended (with or without check-character) barcode from supplied data (also known as Code 3 of 9). CODABAR - Creates a CODABAR barcode from supplied data (used mainly by libraries and blood banks) NOTE: These will require the StringSize UDF by Melba23 ========== CodeQR - Creates a QRcode from supplied data.
    1 point
  6. TheXman

    Barcode Generators

    https://perevoznyk.wordpress.com/2011/11/29/quricol-qr-code-generator-library/ That is the author's site and is where I downloaded the binaries that I used when helping BugFix with his QR Code Creator. If you need to make some QR tags, then @BugFix's QR Code Tools should be able to do the job quite well.
    1 point
  7. As an interesting exercise, I thought I would start this topic that others can add to if they want. Perhaps others, including myself, will learn a thing or more. I will make this first post a kind of index. Basically as any experienced coder knows, there is more than one way to achieve things with your code. Some more complex methods require a good degree of experience to implement, while some are quick and simple but involve a lot of code, and then there are a variety of methods somewhere between the two extremes. Replace Foreign or Accented Characters (jhcd's alternate method) (Danyfirex method) (CYCho method) Toggle Button or Control Text (TheDcoder's solutions plus TheSaint's)
    1 point
  8. I've made an change in the current Beta version, which will temporarily disable the fold.on.open when performing the reload of the file and restore of folds and bookmarks of the original session. Could you give that a try and see whether that works correctly for you? Jos
    1 point
  9. I can see this does make a difference as the updated file is opened again... so let me test with that setting and see whether there is something I can do to ignore that setting when reloading from Tidy. Jos
    1 point
  10. Hi all! This is pretty fast. $sForeignText = "Rosãleê Ündérlæ" $aForeignText = StringSplit($sForeignText, "") $sForeignCharaters = "À,Á,Â,Ã,Ä,Å,Æ,Ç,È,É,Ê,Ë,Ì,Í,Î,Ï,Ð,Ñ,Ò,Ó,Ô,Õ,Ö,×,Ø,Ù,Ú,Û,Ü,Ý,ß,à,á,â,ã,ä,å,æ,ç,è,é,ê,ë,ì,í,î,ï,ð,ñ,ò,ó,ô,õ,ö,ø,ù,ú,û,ü,ý,ÿ" $sEnglishCharaters = "A,A,A,A,A,A,AE,C,E,E,E,E,I,I,I,I,D,N,O,O,O,O,O,x,O,U,U,U,U,Y,B,a,a,a,a,a,a,ae,c,e,e,e,e,i,i,i,i,o,n,o,o,o,o,o,o,u,u,u,u,y,y" $aEnglishCharaters = StringSplit($sEnglishCharaters, ",") $sEnglishText = "" For $i = 1 To $aForeignText[0] $iPosition = StringInStr($sForeignCharaters, $aForeignText[$i], 1) If $iPosition Then $sEnglishText &= $aEnglishCharaters[($iPosition+1)/2] Else $sEnglishText &= $aForeignText[$i] EndIf Next MsgBox(0, "Replacement Text", $sEnglishText)
    1 point
  11. 1 point
  12. First of all, please use AutoIt code tags for your code. About your issue, probably inside the loop it's hangs on WinWaitNotActive call and thus your button event not checked. You could make a wrapper for that function to see if during it's execution there is some events from the GUI: #include <GUIConstantsEx.au3> Global $bStart = False $hGUI = GUICreate("D.A.Recorder", 250, 100) $iStart_Bttn = GUICtrlCreateButton("Start", 10, 10, 80, 30) $iStop_Bttn = GUICtrlCreateButton("Stop", 10, 50, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $iStart_Bttn $bStart = True Case $iStop_Bttn $bStart = False EndSwitch If $bStart Then $Wactive = WinGetTitle("[ACTIVE]") $Begin = TimerInit() $BeginTime = @HOUR & ":" & @MIN ;---- WinWaitNotActive Wrapper ---- ;Just waits until the current active Window is either closed or another window set as active While WinActive($Wactive) Switch GUIGetMsg() Case $iStop_Bttn $bStart = False ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;---- WinWaitNotActive Wrapper ---- If $bStart Then $dif = TimerDiff($begin) ;Calculates the elapsed time in Milliseconds $EndTime = @HOUR & ":" & @MIN $WorkedTime = $dif / 1000 ;Convert the time to seconds $result = StringFormat("%.2f", $WorkedTime) FileWriteLine("OfflineRecorder.txt", $BeginTime & " | " & $EndTime & " | " & $result & " | " & $Wactive) EndIf EndIf WEnd
    1 point
  13. careca

    Mouse recorder

    Should be good now. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Timers.au3> #include <Misc.au3> #include <array.au3> _Singleton("MouseRecord") ; prevents you from accidentially running script twice $log = "MousePos.ini" $Form1 = GUICreate("MouseRecord", 526, 235) $Group1 = GUICtrlCreateGroup("Record", 16, 16, 241, 201) $Label1 = GUICtrlCreateLabel("Enter a name for a new recording:", 32, 40, 164, 17) $Input1 = GUICtrlCreateInput("", 32, 64, 209, 21) $Button1 = GUICtrlCreateButton("Record", 152, 176, 75, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Playback", 272, 16, 233, 201) $Combo1 = GUICtrlCreateCombo("", 288, 64, 201, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) $Label2 = GUICtrlCreateLabel("Choose a recording to play back:", 288, 40, 160, 17) $Button2 = GUICtrlCreateButton("Play Back", 416, 176, 75, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) _LoadListView() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 WinSetState("MouseRecord", "", @SW_HIDE) $varRecordName = GUICtrlRead($Input1) _Record($varRecordName) WinSetState("MouseRecord", "", @SW_SHOW) _LoadListView() Case $Button2 WinSetState("MouseRecord", "", @SW_HIDE) $varReadCombo = GUICtrlRead($Combo1) _Playback($varReadCombo) WinSetState("MouseRecord", "", @SW_SHOW) EndSwitch WEnd ;============================================================================= Func _Record($varRecordName) $i = 1 $varTimerStart = _Timer_Init() Do $varTimerDiff = _Timer_Diff($varTimerStart) If _IsPressed("01") Then ConsoleWrite('diff:'&$varTimerDiff &@CRLF) $varMousePos = MouseGetPos() IniWrite($log, $varRecordName, "Position" & $i, $varMousePos[0] & "," & $varMousePos[1]& "," &$varTimerDiff) $i += 1 Sleep(100) ; long-ish sleep after click $varTimerStart = _Timer_Init() EndIf Sleep(50) ; short sleep to have quick response to pressing escape key Until _IsPressed("1B") EndFunc ;============================================================================= Func _LoadListView() GUICtrlSetData($Combo1, "") ; reset data to nothing $varComboList = "" $arrINISectionNames = IniReadSectionNames($log) If IsArray($arrINISectionNames) Then For $i = 1 To $arrINISectionNames[0] $varComboList = $varComboList & $arrINISectionNames[$i] & "|" Next StringTrimRight($varComboList, 1) ; gets rid of last "|" GUICtrlSetData($Combo1, $varComboList) EndIf EndFunc ;============================================================================= Func _Playback($varReadCombo) $arrReadINI = IniReadSection($log, $varReadCombo) _ArrayDisplay($arrReadINI) For $i = 1 To $arrReadINI[0][0] $arrReadINIData = StringSplit($arrReadINI[$i][1], ",", 2) ConsoleWrite('X - '& $arrReadINIData[0] &' Y - '& $arrReadINIData[1] &' Ms - '&$arrReadINIData[2] &@CRLF) MouseMove($arrReadINIData[0], $arrReadINIData[1], 10) Sleep($arrReadINIData[2]) Next EndFunc I ended up using the split, and just added the delay there, preventing the need to add another value just for the delay. This way it's all in the same line, and avoids problems when reading since we dont have to skip a value.
    1 point
  14. @singh54 That code only tells us that it thinks you're using an outdated browser, so it isn't very helpful in answering your question. What's the URL?
    1 point
  15. RTFC

    MCF - MetaCode File UDF

    MetaCode offers a way to: separate a script's structure from its content remove all redundant definitions (globals and UDFs) change any content (and some structure) combine (new) structure and (new) content into a new script The most useful applications implemented so far are: Fast language translation (not just text strings, also variable names and UDF names) Obfuscation (vars and/or UDFs) Script Encryption (conditionals, calls, and macros) Encryption is powerful because the key is not stored anywhere; you can define it to be a user password, macro, environment spec/variable, server response, something you define yourself, or a combination thereof; anything goes, as long as it's not a fixed string or fixed value. More info in the CodeCrypter thread: ?do=embed' frameborder='0' data-embedContent>'?do=embed' frameborder='0' data-embedContent>> ?do=embed' frameborder='0' data-embedContent> But MetaCode has more potential than that; it allows you to tinker with any type of content separately, then rebuild a new version. So for example, you can have a single script structure and numerous different language modules you just plug in to create a new version in a different language. A brief Tutorial is here: MetaCode Tutorial.pdf The MCF library itself can be found in the CodeScannerCrypter bundle. And a little example how to use it for translating your GUI into a different language: UI_Translator.7z (new version that should work with the new version of Google Translate, see post #13 below) MCF.au3 is just the library plus the MCFinclude.au3 file you need to include in any script you wish to encrypt. There is no GUI here. However, I did write a separate front-end for it called CodeCrypter, which you can find here: ?do=embed' frameborder='0' data-embedContent>'?do=embed' frameborder='0' data-embedContent>> ?do=embed' frameborder='0' data-embedContent> MCF uses output generated by my CodeScanner version 2.8+, which you can find here: '?do=embed' frameborder='0' data-embedContent>> CodeScanner also depends on MCF.au3 now, as it can now call a few of its functions. I should also mention Ward's excellent AES.au3 UDFs used for the encryption and decryption calls, which is now included in the CodeScannerCrypter bundle (thanks to Ward for allowing to include it). You can find the original (unpatched) version here: '?do=embed' frameborder='0' data-embedContent>> Note: you can replace the encryption/decryption calls with whatever algorithm you like (hint: the native <Crypt.au3> library is too slow for most purposes, better stick to machine code routines) So just to be clear: CodeScanner (v2.8+) needs MCF (earlier versions won't work!) CodeCrypter needs MCF (plus anything that MCF needs) MCF itself needs MCFinclude (part of MCF zip) MCF also needs readCSdatadump (part of the CodeScanner package, you need the latest version packaged with CodeScanner v2.8; earlier versions won't work!) both MCF and MCFinclude currently rely on AES.au3 by Ward So you basically need to download the whole bundle for any of it to work. If you have any questions, please start by reading the MCF Tutorial and the CodeCrypter FAQ (you can download the latter separately from the CodeCrypter thread). Next, read the extensive Remarks sections in MCF.au3, MCFinclude.au3, and CodeCrypter.au3 If still no joy, then please post. However, I'm not online that often, and logged in to the forum even less, so response may take a while). RT
    1 point
×
×
  • Create New...