Leaderboard
Popular Content
Showing content with the highest reputation on 07/30/2023 in all areas
-
I was going to say that it would be nice to implement it for different languages but I remembered this picture. Imagine such a function that will work with danish numerals.2 points
-
Convert numbers into words SpellNumber.au3 ; https://www.autoitscript.com/forum/topic/210620-spellnumber-function-to-convert-numbers-to-words/?do=edit ;---------------------------------------------------------------------------------------- ; Title...........: SpellNumber.au3 ; Description.....: Convert numbers into words ; AutoIt Version..: 3.3.16.1 Author: ioa747 ; https://support.microsoft.com/en-au/office/convert-numbers-into-words-a0d166fb-e1ea-4090-95c8-69442cd55d98 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ConsoleWrite("" & SpellNumber(1100.25) & @CRLF) ConsoleWrite("" & SpellNumber(105533) & @CRLF) ;---------------------------------------------------------------------------------------- Func SpellNumber($MyNumber) Local $Coin = "Euro" ; Dollar Local $SubCoin = "Cent" ; Cent Local $Units, $SubUnits, $Temp Local $DecimalPlace, $Count Local $Place[9] $Place[2] = " Thousand " $Place[3] = " Million " $Place[4] = " Billion " $Place[5] = " Trillion " ; String representation of amount. $MyNumber = StringStripWS(String($MyNumber), 8) ; Position of decimal place 0 if none. $DecimalPlace = StringInStr($MyNumber, ".") ; Convert $SubUnits and set $MyNumber to dollar amount. If $DecimalPlace > 0 Then $SubUnits = GetTens(StringLeft(StringMid($MyNumber, $DecimalPlace + 1) & "00", 2)) $MyNumber = StringStripWS(StringLeft($MyNumber, $DecimalPlace - 1), 8) EndIf $Count = 1 While $MyNumber <> "" $Temp = GetHundreds(StringRight($MyNumber, 3)) If $Temp <> "" Then $Units = $Temp & $Place[$Count] & $Units If StringLen($MyNumber) > 3 Then $MyNumber = StringLeft($MyNumber, StringLen($MyNumber) - 3) Else $MyNumber = "" EndIf $Count = $Count + 1 WEnd Switch $Units Case "" $Units = "No " & $Coin & "s" Case "One" $Units = "One " & $Coin Case Else $Units = $Units & " " & $Coin & "s" EndSwitch Switch $SubUnits Case "" $SubUnits = " and No " & $SubCoin & "s" Case "One" $SubUnits = " and One " & $SubCoin Case Else $SubUnits = " and " & $SubUnits & " " & $SubCoin & "s" EndSwitch Return StringStripWS($Units & $SubUnits, 1 + 2 + 4) EndFunc ;==>SpellNumber ;---------------------------------------------------------------------------------------- Func GetHundreds($MyNumber) ; Converts a number from 100-999 into text Local $Result If Int($MyNumber) = 0 Then Return $MyNumber = StringRight("000" & $MyNumber, 3) ; Convert the hundreds place. If StringMid($MyNumber, 1, 1) <> "0" Then $Result = GetDigit(StringMid($MyNumber, 1, 1)) & " Hundred " EndIf ; Convert the tens and ones place. If StringMid($MyNumber, 2, 1) <> "0" Then $Result = $Result & GetTens(StringMid($MyNumber, 2)) Else $Result = $Result & GetDigit(StringMid($MyNumber, 3)) EndIf Return $Result EndFunc ;==>GetHundreds ;---------------------------------------------------------------------------------------- Func GetTens($TensText) ; Converts a number from 10 to 99 into text. Local $Result = "" ; Null out the $Temporary function value. If Int(StringLeft($TensText, 1)) = 1 Then ; If value between 10-19... Switch Int($TensText) Case 10 $Result = "Ten" Case 11 $Result = "Eleven" Case 12 $Result = "Twelve" Case 13 $Result = "Thirteen" Case 14 $Result = "Fourteen" Case 15 $Result = "Fifteen" Case 16 $Result = "Sixteen" Case 17 $Result = "Seventeen" Case 18 $Result = "Eighteen" Case 19 $Result = "Nineteen" Case Else EndSwitch Else ; If value between 20-99... Switch Int(StringLeft($TensText, 1)) Case 2 $Result = "Twenty " Case 3 $Result = "Thirty " Case 4 $Result = "Forty " Case 5 $Result = "Fifty " Case 6 $Result = "Sixty " Case 7 $Result = "Seventy " Case 8 $Result = "Eighty " Case 9 $Result = "Ninety " Case Else EndSwitch $Result = $Result & GetDigit(StringRight($TensText, 1)) ; Retrieve ones place. EndIf Return $Result EndFunc ;==>GetTens ;---------------------------------------------------------------------------------------- Func GetDigit($Digit) ; Converts a number from 1 to 9 into text. Local $Result Switch Int($Digit) Case 1 $Result = "One" Case 2 $Result = "Two" Case 3 $Result = "Three" Case 4 $Result = "Four" Case 5 $Result = "Five" Case 6 $Result = "Six" Case 7 $Result = "Seven" Case 8 $Result = "Eight" Case 9 $Result = "Nine" Case Else $Result = "" EndSwitch Return $Result EndFunc ;==>GetDigit ;----------------------------------------------------------------------------------------1 point
-
"GuiCtrls_HiDpi" (UDF in progress)
simplercoder000 reacted to argumentum for a topic
... lets do some marketing first: pardon the image size of 225% scale on another monitor The idea is to have some DPI awareness in our GUIs and with this all you have to do is prefix "_HiDpi_" to your current code. Simple. This version ( HiDpi v. 0.2023.7.29(b) stable.zip ) is stable but only system aware. ( pictures above ) This next version ( HiDpi v. 0.2023.8.3(a) under development.zip ) is what I've got so far in regards of per-monitor awareness This one ( HiDpi v. 0.2023.8.4(ResizeTestbed) under development.zip ) is for the brave of heart. I'm looking for ideas. This is a testbed for anyone wanting to contribute regarding resizing controls. I have now started to use _WinAPI_DPI.au3 because I feel that this UDF is ready for that UDF. Therefore, too many and too big files for copy and paste. And that is good. Means that the UDF is getting closer to stable. FAQ (of sorts) Q: When did you come up with this ? A: Never. These are helper functions for _WinAPI_SetDPIAwareness.au3 but I did not get to finish. Nonetheless it's functional as is and applies to most of the cases in need of DPI awareness. Per-monitor would need more involved coding and I only have so much time and know how for now. Q: Will you open a ticket and ask to be included in the standard UDFs ? A: No. This is a just for now. Eventually the functionality would be a standard feature without the need of this. Q: Will you add ... A: Only in the case that either, I realize is needed and code it or, you code it and ask to be included in this bundle of functions UDF Q: This is not working ... A: The best way to go about a problem with this code is to open it's own thread in GUI Help and Support and post there with a mention of me. I'll read and answer there. Q: Are you going to share "logo4.gif", "SampleAVI.avi", etc. A: You are right. I forgot to say that the example file will work as expected if created in "..\Examples\GUI\HiDpi_v_n.n.n.n\", as a subfolder of where "SampleControls.au3" is at. There it will find all the files required for the example. Because after all, this example is that example but "_HiDpi_fied" ( so to say ). Q: Is there a tool that will magically update all my old scripts ? A: I've posted a script to get you closer but is not magical. Should work just fine for simple GUIs. Q: Are you going to work on a Per-monitor version ? A: yes, as time permits.1 point -
Words Per Minute Typing Speed Calculator
Dan_555 reacted to TalesFromTheScript for a topic
I've asked for help here numerous times and there's never been a time any problem I had with code wasn't solved. Yes it might be met with scorn, but I expect that since I am not a coder myself and any working script I made is on a wing and a prayer. 😄 Anyway, with the help of Chat GPT and ironing out the bugs, I made an AutoIt GUI that counts your words per minute. I thought I might as well share what I made. I know... "Loads of online sites already do that" but they don't do what this does and I could not find any free tool that does what this does either.😉 With the online typing tests that count words per minute, they make you look at words on screen - but what if you aren't a typist and you have to look at the keyboard when you're typing? I know I do. This GUI doesn't give you anything to type, you can just type in whatever you want. Also missing from any typical online test is accuracy. My GUI shows you the words per minute with 1 decimal place. Not only that, but it keeps a record (in a text file) of your entire typing history, in terms of how many words per minute you typed, then every time you run the GUI, it shows you what your all-time average typing speed is. As you use the GUI more, it builds up a history of your typing speed so you can get a very accurate average over time. All you have to do is type something in and stop typing for at least 4 seconds and it will tell you how many words per minute you typed. No need to type for a full minute either, you can type for any amount of time. The text typed is then cleared and you're shown your word per minute count, that's then added to all the other times you tested your typing. The only reason I made this was because none of the online typing speed tests quite worked the way I wanted and why should I need to be on some website anyway. This will work whether you have an internet connection or not. This still has the odd bug. For example if you just type a space and leave it alone, it will say you typed about 4,000 words per minute, so don't do that. 😇 Anyway here it is. If you're interested in what speed you type at, this could be a great tool, especially because it can build up a very accurate average with a lot of usage. I'm about to get a different keyboard so, it's going to come in handy to test if my typing is any faster on the new keyboard, now I have built up a solid average on this keyboard of about 76 WPM. Enjoy! #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $hGUI, $hEdit, $hAverageLabel, $hTypingLabel, $hTimer, $startTime, $endTime, $wordCount Global $totalCount, $sum, $isFinished, $showAverage, $average $hFile = FileOpen("WordsPerMinute.txt", 1) $hGUI = GUICreate("Typing Speed Calculator", 600, 485, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN), $WS_EX_CLIENTEDGE) $hEdit = GUICtrlCreateEdit("", 10, 10, 580, 350, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) GUICtrlSetState($hEdit, $GUI_FOCUS) GUICtrlSetFont($hEdit, 16, 400, "Segoe UI") $hAverageLabel = GUICtrlCreateLabel("", 10, 428, 580, 40, BitOR($SS_CENTER, $WS_BORDER, $SS_CENTERIMAGE, $SS_NOTIFY)) ; Add $SS_NOTIFY style GUICtrlSetFont($hAverageLabel, 16, 700, "Segoe UI") $hTypingLabel = GUICtrlCreateLabel("", 10, 374, 580, 40, BitOR($SS_CENTER, $WS_BORDER, $SS_CENTERIMAGE)) GUICtrlSetFont($hTypingLabel, 16, 700, "Segoe UI") GUICtrlSetColor($hTypingLabel, 0x00008B) ; Set the color of the typing label to dark blue GUICtrlSetColor($hAverageLabel, 0x006400) ; Set the color of the average label to dark green GUISetFont(9, 400, "Segoe UI") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CLOSE, "WM_CLOSE_HANDLER") Func UpdateAverage() Local $aWordsPerMinute = FileReadToArray("WordsPerMinute.txt") If UBound($aWordsPerMinute) > 0 Then Local $overallSum = 0 For $i = 1 To UBound($aWordsPerMinute) $overallSum += $aWordsPerMinute[$i - 1] Next $totalCount = UBound($aWordsPerMinute) $sum = $overallSum $showAverage = True If $totalCount > 0 Then $average = Round($sum / $totalCount, 1) EndIf EndIf EndFunc UpdateAverage() While 1 If Not WinActive($hGUI) Then $hTimer = 0 ContinueLoop EndIf If $hTimer And TimerDiff($hTimer) > 4000 Then $endTime = TimerDiff($startTime) - 4000 ; Subtract 4 seconds of inactivity $wordCount = _CountWords(GUICtrlRead($hEdit)) $wordCount = Round($wordCount / ($endTime / 60000), 1) ; Calculate WPM with one decimal place GUICtrlSetData($hTypingLabel, "You have just typed " & $wordCount & " WPM") $isFinished = True GUICtrlSetData($hEdit, "") GUICtrlSetState($hEdit, $GUI_FOCUS) $hTimer = 0 If $wordCount > 0 Then $totalCount += 1 $sum += $wordCount FileWriteLine($hFile, $wordCount) EndIf UpdateAverage() GUICtrlSetData($hAverageLabel, "All-time average = " & $average & " WPM") EndIf If $showAverage Then If $totalCount > 0 Then GUICtrlSetData($hAverageLabel, "All-time average = " & $average & " WPM") EndIf $showAverage = False EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE FileClose($hFile) Exit Case $hEdit If Not $hTimer Then $startTime = TimerInit() $hTimer = TimerInit() $isFinished = False GUICtrlSetData($hTypingLabel, "Timer running...") GUICtrlSetData($hAverageLabel, "") EndIf EndSwitch Sleep(100) WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $nCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0xFFFF) Switch $nID Case $hEdit If $nCode = $EN_CHANGE Then If Not $hTimer Then $startTime = TimerInit() $hTimer = TimerInit() $isFinished = False GUICtrlSetData($hTypingLabel, "Timer running...") GUICtrlSetData($hAverageLabel, "") Else $hTimer = TimerInit() EndIf EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc Func WM_CLOSE_HANDLER($hWnd, $iMsg, $wParam, $lParam) Return 0 ; Return 0 to prevent the GUI from closing EndFunc Func _CountWords($sText) Local $aWords = StringRegExp($sText, "[^\s]+", 3) Local $wordCount = UBound($aWords) If $wordCount = 1 And StringLen($sText) = 1 Then Return 0 EndIf Return $wordCount EndFunc1 point -
German 29.929.292 would spell "nine and twenty millions nine hundred nine and twenty thousand two hundred two and ninety." It can be confusing when you come from a "90+2" country1 point
-
CryptoNG UDF - Cryptography API: Next Gen
argumentum reacted to TheXman for a topic
What's New in Version v2.1.0 Added new ECDSA signing functions: CryptoNG_ECDSA_CreateKeyPair CryptoNG_ECDSA_SignHash CryptoNG_ECDSA_VerifySignature Added ECDSA Signing and Signature Verification examples to the CryptoNG examples file. create_ecdsa_key_pair_example() ecdsa_sign_and_verify_example() Updated the supplied CryptoNG calltips and userudfs files to include the new ECDSA Signing and Signature Verification functions. Added the new ECDSA Signing and Signature Verification functions to the CryptoNG UDF Help File. Added new constants to support ECDSA signing functions. Misc function header corrections & modifications. Misc Help File corrections & modifications. Moved the version history log from the UDF to an external file (Version History.txt).1 point -
Hello, This is my first post here although I've been using Autoit for around 5 years. Several years ago I started looking for a template to make Invoicing software in Autoit. For PDF generation I ran across MIPDF by Mihai Iancu and it works great. So I am including that along with the Invoice template that I created. I hope you all enjoy it and take it further than me and make a full featured personal financial manager in Autoit! Autoit Invoicing.zip1 point
-
; InputBox OnTop ; Author - herewasplato $ans = _InputBoxOnTop("Title", "Prompt") If @error = 0 Then MsgBox(0, "Returned", $ans) If @error = 1 Then MsgBox(0, "", "The Cancel button was pushed.") If @error = 2 Then MsgBox(0, "", "The Timeout time was reached.") If @error = 3 Then MsgBox(0, "", "The InputBox failed to open.") Func _InputBoxOnTop($IBTitle, $IBPrompt, $IBDefault = "", _ $IBpassword_char = "", $IBWidth = -1, $IBHeight = -1, _ $IBLeft = Default, $IBTop = Default, $IBTimeOut = "") Local $file = FileOpen(EnvGet("temp") & "\InputBoxOT.au3", 2) If $file = -1 Then Return;if error, give up Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')' Local $line2 = 'WinWait("' & $IBTitle & '", "' & $IBPrompt & '")' Local $line3 = 'WinSetOnTop("' & $IBTitle & '", "' & $IBPrompt & '" ,1)' FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3) FileClose($file) Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\InputBoxOT.au3") Local $ans = InputBox($IBTitle, $IBPrompt, $IBDefault, _ $IBpassword_char, $IBWidth, $IBHeight, _ $IBLeft, $IBTop, $IBTimeOut) If @error Then $ans = @error While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3") Sleep(10) WEnd SetError($ans) $ans = "" Return $ans EndIf While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3") Sleep(10) WEnd Return ($ans) EndFunc ;==>_InputBoxOnTop1 point
-
I agree with the array approach example: ; https://www.autoitscript.com/forum/topic/210615-converting-string-into-a-variable-name/?do=findComment&comment=1521771 #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <array.au3> Global $id = 0 ; active selection Global $aQuad[][] = [ _ ["X", "Y", "W", "H"], _ [100, 100, 200, 200], _ [200, 100, 300, 300], _ [500, 200, 800, 600], _ [300, 300, 1000, 700]] ;~ _ArrayDisplay($aQuad) While 1 Global $sInputBoxAnswer = InputBox("Which quadrant to show?", @CRLF & "Number only", $id + 1) Select Case @error = 0 ;OK - The string returned is valid ConsoleWrite("$sInputBoxAnswer=" & $sInputBoxAnswer & @CRLF) $id = Int($sInputBoxAnswer) If $id > 0 And $id <= UBound($aQuad) - 1 Then ConsoleWrite("X=" & $aQuad[$id][0] & ", ") ConsoleWrite("Y=" & $aQuad[$id][1] & ", ") ConsoleWrite("W=" & $aQuad[$id][2] & ", ") ConsoleWrite("H=" & $aQuad[$id][3] & @CRLF) MouseMove($aQuad[$id][0], $aQuad[$id][1]) ToolTip($aQuad[$id][0] & ", " & $aQuad[$id][1], $aQuad[$id][0], $aQuad[$id][1], "MouseMove XY") Sleep(500) MouseMove($aQuad[$id][2], $aQuad[$id][3]) ToolTip($aQuad[$id][2] & ", " & $aQuad[$id][3], $aQuad[$id][2], $aQuad[$id][3], "MouseMoveWH") EndIf Case @error = 1 ;The Cancel button was pushed Exit EndSelect Sleep(3000) ConsoleWrite("" & @CRLF) ToolTip("") WEnd0 points