ARPFre Posted February 6, 2022 Posted February 6, 2022 Good afternoon everyone. Sorry for any errors, I'm using Google Translate. The example of the posted script is very simple, as I am in the testing and learning phase. I would like to know if it is possible to create "mask" or "format" a text. Example: I'm doing a WMI Query where the result is: Windows Install Date: 20201123104757.000000-180 Total Memory: 8201288 I wanted it to be shown more accessible to users: Windows Install Date: 2020/11/23 10:47 Total Memory: 8 GB TestNumbers.au3
Solution Nine Posted February 6, 2022 Solution Posted February 6, 2022 (edited) Here : $InstallDate = "20201123104757.000000-180" $TotalMemory = 8201288 MsgBox(0,"", StringRegExpReplace($InstallDate, "(\d{4})(\d{2})(\d{2})(\d{2})(\d{2}).*", "$1/$2/$3 $4:$5")) MsgBox(0,"", GetNum($TotalMemory)) Func GetNum($iNum) Local $aSig = ["K", "M", "G", "T"] For $i = 0 to UBound($aSig) - 2 If $iNum < 1000 Then Return $iNum & $aSig[$i] $iNum = Floor($iNum/1000) Next Return $iNum & $aSig[$i] EndFunc When you post code, use the method shown in the link Edited February 6, 2022 by Nine ARPFre 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ARPFre Posted February 7, 2022 Author Posted February 7, 2022 @Nine Sorry for the delay, it was a holiday yesterday in Brazil! Thank you very much! It worked perfect! Now I'm going to study how it was created to repeat in other Query!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now