My goal is to copy all the text and save parts of it to different named clipboards: 1111222233334444 05/66 789
I want to save:
“1111222233334444” to named clipboard 1
"05" to named clipboard 2
"66" to named clipboard 3
"789" to named clipboard 4
It will be in the same format just different digits, the number of digits will be the same: 1111222233334444 05/66 789 or 4444666677779999 07/89 987 or 3456765487651234 77/22 789
Not sure how to split, probably copy first 16 digits then next 2, next 2 and next three.
Here is an example using RegEx to extract the numbers and store in variables. I highly recommend using KM Variables instead of Named Clipboards if you are just storing text. You need Clipboards only if you are storing images, objects, or styled text.
If you want to make the KM Variables available to other macros and/or subsequent executions of this macro, just remove the prefix of "Local__" from each variable. This makes them global Variables. I would probably replace with a common prefix like "DND_NFS__" where:
"DND" -- stands for "Do Not Delete"
"NFS" -- stands for "Numbers From String"
I'd probably use an acronym that reflects the content
Questions?
Example Results
Here is the RegEx: (\d{16})\h+(\d{2})\/(\d{2})\h+(\d{3})
See the explanation of it here:
Macro: Extract Numbers from String via RegEx [Example]
Guys, the next part of my macro is to set a condition and fill a web form with month (01-12) / year (2018-2043)
If the variable Local_Num2 = 01 then type text Jan, If 02 then type Feb etc...
If the variable Local_Num3 = 18 then type text 2018, of 2019 then type 2019 etc...
No problem, @kreal. Assuming you're running KM8 there is indeed a simpler way to do this, by using a dictionary. First, download and run this macro (feel free to edit it to suit your needs):
Once that's done, and the dictionary has been created, you can then use your variable to reference the appropriate key value like this:
%Dictionary[Months,%Variable%Num2%]%
In your case, you can just use an Insert Text action with the same syntax, no If Then Else action required:
As for the year, that's easier than you might think. Since it sounds like the Num3 variable will always be the last two digits of the year, and you know you'll be sticking to years prefixed with "20", you can just do this:
Make sense? Feel free to ask post again if anything is unclear!
I believe that my original macro solved your first request. Here's an updated macro that handles your additional requirements. Please let us know if you have further questions.
So here is the test string I used for development/validation: