Leaderboard
Popular Content
Showing content with the highest reputation on 02/24/2024 in all areas
-
Well, it's in the notes... While listening to an audio book I got annoyed at the constant misreading of numbers. Example: 692,000 would be read as six hundred ninety two zero-zero-zero. It got me thinking, how difficult is it to read them out to an understandable value? See Zips for Examples AutCode is a part of my personal format library, not sure I'll be releasing it, but maybe. Edit: 02/25/2024 This is script breaking, I added more bloat (purposely) and added Spanish as a sub language. I'm not 100% sure if it's absolutely correct though lol. Same day: Fixed decimal issue and returning the not needed zero/cero at the end of 1200 etc Same day: Added some escape char code for ramdon delimiters being passed Edit: 02/26/2024 Added a Text to Number approach, seems to work on English. Fixed code for NumberToText... probably going to zip them, cuz my copy-paste-kungfu is evidently weak! Same day, fixed Spanish issue with y un mil being shown as y mil Edit: 02/27/2024 Added Text to Number approach for Spanish as well, update in zip as well as an example Update same day: had to fix some found issues with decimal, didn't realize I did case sensitive, and I'm to lazy to make it an option (as we're working with numbers and I don't feel like we should have case sensitivity). Updated same day: fixed some other language issues found in Spanish with something like "mil" only being sent to Text To Number. Added: _AutCode_TextNumberGetLanguage , it's just a simple way to get the language of the numbers you're sending... If I'm being honest, I don't see it being incredibly useful. At the moment, it's sending a string return of the language, I don't like this, so I may change it to what it should be in my opinion (to match $N2T_XXX vars). But I'm tired of playing with this thing atm. Edit: 03/01/2024 Added a database version, it's been nearly a decade since I played with databases, so it is definitely not marked for speed at the moment. Once I'm more proficient (again ), I'll probably update the query optimization and db performance... right now it's fairly vanilla... But hey, it works. See NumTextNumDB zip for this one. Zip has both x86/x64 sqlite3 dll from official site (feel free to download your own if you don't want to do a checksum or don't trust mine) and the .db3 filled with the query data. Edit: 03/03/2024 Fixed: English and Spanish only returning blank string when "0", "00", or "000" only is passed Fixed: English and Spanish returning zero [thousands,millions] when something like 100,000,000 is passed Added: German and French -- Removed non-db version that I am no longer updating because it has less features and the same features are in the db version. NumTextNumDB_03032024(1).zip3 points
-
True AutoIt multi-threading!
jaberwacky reacted to NHD for a topic
This is my experiment to achieve multi-threading in AutoIt 馃槄 Source code, usage and examples in this github repo: https://github.com/nomi-san/true-autoit-multi-threading1 point -
1 point
-
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
-
Number to Text String And Text To Number (English/Spanish/German/French)
SmOke_N reacted to argumentum for a topic
BuildIt("Make 692000, and be happy.") ; didn't read the book =P Func BuildIt($sStr) Local $aArray = StringSplit(StringReplace(StringStripWS($sStr, 7), ",", " , "), " ") $sStr = "" For $n = 1 To $aArray[0] If Number($aArray[$n]) == $aArray[$n] Then $sStr &= StringStripWS(_AutCode_NumberToText($aArray[$n]), 7) & " " Else $sStr &= $aArray[$n] & " " EndIf Next $sStr = StringReplace($sStr, " , ", ",") ConsoleWrite('+++ ' & $sStr & @CRLF) SayIt($sStr) EndFunc ;==>BuildIt Func SayIt($sStr = "Replace with that you wanna say.") Local Static $oSapi = ObjCreate("Sapi.SPVoice") $oSapi.Speak($sStr) EndFunc ;==>SayIt Look. A book reader Thanks for sharing.1 point -
SpellNumber function to convert numbers to words
argumentum reacted to ioa747 for a topic
in Greek language ; https://www.autoitscript.com/forum/topic/210620-spellnumber-function-to-convert-numbers-to-words ;---------------------------------------------------------------------------------------- ; Title...........: SpellNumber.au3 ; Description.....: Convert numbers into words - Greek ; 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 = "ευρ蠈" ; Dollar Local $Units, $SubUnits, $Temp Local $DecimalPlace, $Count Local $Place[9] $Place[2] = " χ委λια " $Place[3] = " εκατομμ蠉ριο " $Place[4] = " δισεκατομμ蠉ριο " $Place[5] = " τρισεκατομμ蠉ριο " ; 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 = "ακριβ蠋ς " Case "苇να" $Units = "苇να " & $Coin Case Else $Units = $Units & " λεπτ维" EndSwitch Switch $SubUnits Case "" $SubUnits = " ακριβ蠋ς" Case "苇να" $SubUnits = " και 苇να λεπτ蠈" Case Else $SubUnits = " και " & $SubUnits & " λεπτ维" EndSwitch Local $Result = StringStripWS($Units & $SubUnits, 1 + 2 + 4) $Result = StringReplace($Result, "苇να εκατ蠈", "εκατ蠈ν") $Result = StringReplace($Result, "苇να χ委λια", "χ委λια") Return $Result 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)) & " εκατ蠈 " 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 = "δ苇κα" Case 11 $Result = "苇νδεκα" Case 12 $Result = "δ蠋δεκα" Case 13 $Result = "δεκατρ委α" Case 14 $Result = "δεκατ苇σσερα" Case 15 $Result = "δεκαπ苇ντε" Case 16 $Result = "δεκα苇ξι" Case 17 $Result = "δεκαεπτ维" Case 18 $Result = "δεκαοχτ蠋" Case 19 $Result = "δεκαενν苇α" Case Else EndSwitch Else ; If value between 20-99... Switch Int(StringLeft($TensText, 1)) Case 2 $Result = "ε委κοσι " Case 3 $Result = "τρι维ντα " Case 4 $Result = "σαρ维ντα " Case 5 $Result = "πεν萎ντα " Case 6 $Result = "εξ萎ντα " Case 7 $Result = "εβδομ萎ντα " Case 8 $Result = "ογδ蠈ντα " Case 9 $Result = "εννεν萎ντα " 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 = "苇να" Case 2 $Result = "δ蠉ο" Case 3 $Result = "τρ委α" Case 4 $Result = "τ苇σσερα" Case 5 $Result = "π苇ντε" Case 6 $Result = "εξι" Case 7 $Result = "επτ维" Case 8 $Result = "οκτ蠋" Case 9 $Result = "εν苇α" Case Else $Result = "" EndSwitch Return $Result EndFunc ;==>GetDigit ;----------------------------------------------------------------------------------------1 point -
Ha, I never bothered searching the forum for an already done example (I see there were a few now)... I was just annoyed when I did mine! 馃槀1 point
-
True AutoIt multi-threading!
jaberwacky reacted to SmOke_N for a topic
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminatethread TerminateThread, but I read somewhere that GetCurrentThreadId from Kernel32 dll was deprecated, so I can't see "TerminateThread" from the processthreadsapi api being to safe tbh.1 point -
Read Serial Number (extern drive)
argumentum reacted to Noobis for a topic
Function DriveGetSerial (autoitscript.com)1 point -
ID3.au3 UDF Description: Reads ID3v1.0, ID3v1.1, ID3v1.1+, ID3v2.2, ID3v2.3, ID3v2.4, APEv2 and MPEG frame header Writes ID3v1.1, ID3v2.3, ID3v2.4 Latest Version v3.4 20120610 AutoIt Version Required: 23rd December, 2011 - v3.3.8.0 of AutoIt ID3 functions only works with .mp3 files Notes: More info on the ID3 format can be found at http://www.id3.org/Developer_Information and http://en.wikipedia.org/wiki/ID3 More info on the APE tag format can be found at http://wiki.hydrogenaudio.org/index.php?title=APEv2_specification If you only care about getting the basic info ie. Album, Artist, Track and Song Title then look into using Udf: Get Extended FIle Properties More ID3 implementations http://www.id3.org/Implementations Changes in latest version (see files for all changes): ID3_v3.4.au3 (06/10/2012) Added resetting of all global ID3 variables in _ID3ReadTag() to make sure they are set back to the default values changed _ID3WriteTag() to determine what tags have been read and to only write back those version if $iTagVersion=-1 edited _ID3WriteTag() comments added $iReturnTypeFlag to _ID3GetTagField() inputs for ID3v2 functions fixed _ID3GetTagField() so that @extended is set to the Number of frames that exist with same $sFrameIDRequest fixed _h_ID3v2_EncodeStringToBinary() variable typo ($FrameData should be $bFrameData), thanks BrewManNH! ID3_Example_GUI_v3.4.au3 (06/10/2012) changed all _ID3v1Field_GetString and _ID3v2Field_GetString to _ID3GetTagField ID3_SimpleExamples_v3.4.au3 (06/10/2012) I have realized that the GUI example has become overly complex, so I have added this file to help show how I intended ID3.au3 to be used. Simple Read Tag Example: $Filename = FileOpenDialog ( "Select Mp3 File", "", "Muisc (*.mp3)") $sTagInfo = _ID3ReadTag($Filename) MsgBox(0,"TagInfo",$sTagInfo) MsgBox(0,"ID3v1 Title",_ID3GetTagField("Title")) ;Title from ID3v1 MsgBox(0,"ID3v2 Title",_ID3GetTagField("TIT2")) ;Title from ID3v2 Simple Write Tag Example: $Filename = FileOpenDialog( "Select Mp3 File", "", "Muisc (*.mp3)") $sTagInfo = _ID3ReadTag($Filename) _ID3SetTagField("COMM","TEST COMMENT - ID3v2 Comment Tag") _ID3WriteTag($Filename) Latest Version v3.4 20120610 ID3v2.3TagSpec.pdf ID3v2.4TagSpec.pdf ID3_Example_GUI_v3.4.au3 ID3_SimpleExamples_v3.4.au3 ID3_v3.4.au31 point
-
Splash Screen with Transparency
teodoric666 reacted to Skeletor for a topic
Hi All, I know many newbies search for this feature. I decided to share this piece of code with everyone. Basically its a "splash screen" that has a transparent image. In a nutshell - Gui with a transparent gif. Enjoy... Download attachment.... Splash Screen GUI.zip1 point