Search the Community
Showing results for tags 'trim'.
-
I have this example string: 2020-06-08 09:23:33 : abcdefghifjklm How to trim just the right part? Or how to trim this text right to left? I want to trim this string right to left until ' : '. In ohter words: I need the 'abcdefghifklm' text. I have tried StringTrimRight, but that requires The number of characters to trim. Unfortunately StringSplit trims the left part of the strings.
-
The McAfee return for AV defs per "C:\Progra~1\Common~1\McAfee\SystemCore\csscan.exe -Versions" is ... CommonShell Command Line Scanner Lite (VSCORE.15.5.0.3960) Engine version: 5800.7501 DAT version: 8450.0 Time required: 15 milliseconds I want to isolate the actual DAT version as "8450.0". There may be an easier way to get the DAT Version via other McAfee or registry methods but essentially I just want to know how to parse a string at a character or @CRLF into two separate strings for further parsing. Example: $string = "Name=Microsoft Windows 10 Professional |C:\windows|\Device\Harddisk0\Partition2" Parse into $var1 = "Name" & $var2 = "Microsoft Windows 10 Professional |C:\windows|\Device\Harddisk0\Partition2" From there I'd like to parse $var2 at "|" into $var3 = "Microsoft Windows 10 Professional" and $var4 "C:\windows|\Device\Harddisk0\Partition2"
- 16 replies
-
- stringsplit
- parse
-
(and 1 more)
Tagged with:
-
Hello, I have a simple task today, I am sure that I made a similar post a long time ago... I want trim (delete or remove or wipe) the contents of a file (text or binary) WITHOUT storing the contents of the file anywhere in the script. Here is a text file for the purpose of experimenting: (contents of text.txt) 1234567890The task is simple, remove "456" from the contents of text.txt WITHOUT storing the contents anywhere! I wanted to post some code but it seems impossible to provide any relevant code this time... Good luck with the challenge! TD
-
I'm looking to delete string from point A to point B... For example: "I want to go to store" I would think I need 2 variables. $sfind1 = want $sfind2 = to. Anything between $sfind1 and $sfind2 will be delete it. I would think stringtrim left or right, but the problem I'm facing is, trim left/right does not have a point a or point b to trim from and to. It would be useful if a function was created to do this job if it doesn't already exist.
-
Hello everyone, I have been a member for a while but relatively new to posting to the message boards. I am also still relatively new to using AutoIt. I am working on a script that will help keep a program running on one of my file servers. Here is what I have accomplished so far looking at different threads on the site already. 1. A check performed every 60 seconds to see if the application is running. (ultimately to be changed to something like once an hour) 2. Write a log file that shows either the check was performed with no issue or the application had to be restarted. Both of those are working fine and I have to say that ever since I started using this script the program has not crashed! My next phase is to figure out how to make the script check and trim the log file. I am obviously not trying to make a log file that becomes bloated and chews up a large amount of hard drive space. The main purpose of the log file is so that I know if the application has been restarted. I am thinking have the script trim the file every 30 day maybe. Another words delete everything in the log file 30 days prior to the current day. So if someone can help me out here as I am not a scripting genius. Unfortunately I only know enough to be dangerous if you will. I also have another part of this script I want to write but first I want to get the log file working just the way I want. I am attaching a sample of what I have working so far. Thank you for any and all help folks. Respectfully, James #include <File.au3> While 1 ;Start Loop If ProcessExists("atcsmon.exe") Then ;~ Open the logfile in write mode. Local $hFile = FileOpen(@ScriptDir & "\ATCS_AutoIt.log", 1) _FileWriteLog($hFile, "ATCS check was completed and found running by the AutoIt3 Script") ; Write to the logfile passing the filehandle returned by FileOpen. FileClose($hFile) ; Close the filehandle to release the file. Else ;If Process does not exist Run("C:\atcs_monitor\atcsmon.exe", "", @SW_SHOWMINIMIZED) ;~ Open the logfile in write mode. Local $hFile = FileOpen(@ScriptDir & "\ATCS_AutoIt.log", 1) _FileWriteLog($hFile, "*ALERT* *ALERT* *ALERT* ATCS was restarted by the AutoIt3 Script") ; Write to the logfile passing the filehandle returned by FileOpen. FileClose($hFile) ; Close the filehandle to release the file. EndIf Sleep(60000) ;sleep 60 seconds WEnd ;Close Loop