[SOLVED] StringRegExp remove path from Array
-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By RAMzor
Hi everyone,
I have this string:
"main_lot 0x111” & @CRLF & “main_version 0xABC” & @CRLF & “main_number 0xDEAD123” & @CRLF & “main_version 0x333"
And I'm trying to extract one specific hexadecimal number, actually main_version from this string by using StringRegExp:
How to get 'ABC' from it?
I'm not sure if the original string uses @CRLF, @CR or @LF as a line breaks (received from linux over ssh plink.exe) I have tried this code but it doesn't work
#include <Array.au3> $sLog = "main_lot 0x111” & @CRLF & “main_version 0xABC” & @CRLF & “main_number 0xDEAD123” & @CRLF & “main_version 0x333" $aVer = StringRegExp($sLog, "main_version\h*(.+)(?:0[xX][[:xdigit:]])", 3) _ArrayDisplay($aVer)
-
By TheAlienDoctor
Hi, I was looking into creating a script that would detect if a file exists, then move it (and in some cases rename it, depending on the file) as well as write to a log file.
The issue is, there is a lot of files that need to be moved, sometimes some files will exist and others won't depending on the use-case. However if a file does exist, it will always be going into the same directory with the same name.
Currently I have an array nested inside of the array, with each array inside that array having both the old and new directory, and then a For loop to actually run through and do the file transferring. The issue I am having is how to call the Array inside of the array, because how do I specify which the old directory is and which the new is?
Global $FileTransfer[2000] = [Global $Dir1[2] = ["original dir 1", "new dir 1"], Global $Dir2[2] = ["original dir 2", "new dir 2"]] For $FileTransfer = [0] To [1] Step +1 If FileExists({original dir}) Then FileMove({original dir}, new dir, 1) FileOpen("log.latest.txt", 1) FileWrite("log.latest.txt", "{original dir} found, moved it to new dir." & @CRLF) FileClose("log.latest.txt") Else FileOpen("log_latest.txt", 1) FileWrite("log_latest.txt", "{original dir} not found, ignoreing it." & @CRLF) FileClose("log_latest.txt") EndIf Next I have put what I want the old and new directory to be for each array in {}, so hopefully its easier to tell which part is working and whats not.
I am still reasonably new to AutoIT, any help is appreciated. Thankyou
-
By arunkw
I have a spreadsheet - daily routine which has two columns: activity and time as shown here
| Activity | Time | |----------------------|----------| | Sleep | 6:00 am | | Toilet | 6:15 am | | Get ready for gym | 6:30 am | | Exercise | 7:50 am | | ... more things | 9:00 pm | | ... still more | 10:45 pm | | Sleep | 6:00 am | I wanted to find out, say in C1 which activity is current for me using now() I.e., if it’s 6:45am on my watch, it should show me Exercise in C1 Thanks to Adam D. PE, this formula works like magic to get the result =VLOOKUP(MOD(NOW(),1),{B2:B,A2:A},2,1) Now, I want to reproduce same result in autoit, how to do that? To have easy solution say, I copy-paste spreadsheet data in array directly in code, right? Use for loop and run the above vlookup function and show the answer using tooltip. How to achieve this? please help. -
By goku200
I have an Autoit script that lists files from a folder into an array list. Is there a way to separate the filenames by an underscore and include the id, version, name and date into separate columns in Excel.
Example of filename:
12345_v1.0_TEST Name [12345]_01.01.2022.html
12345 would be in one column
v1.0 would be in another column
TEST Name [12345] would be in another column
01.01.2022 would be in another column
.html would be in another column
Note: filenames always change each day.
Here is my code that lists the files into column C and then writes the column Headers into Column D, E, F, G. Just need some help with separating them into columns by the _ delimiter
-
By mLipok
Usually when I collect data from DataBase I need to give EndUser a possibility to select rows which should be taken in the processing loop.
I was searching on the forum and I'm not able to find any UDF or even example of how to select data from array.
I have my own solutions but I think they are not worth posting on the forum as it is very old code and I am looking for a better solution.
Could anybody point me to some examples/solutions ?
Thank you in advance.
@mLipok
-
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