MMM is not great at any real string functions. I'm working on adding it in but its not made it's way into a release. I'd had a bit of time off releasing any updates for MMM however i'm getting back on the wagon and will try to get a minor release out with some more string functions.
I am very grateful for all your effort, I will see what I can do with those 2 options that you mentioned ,,,, however I already found another way of solution., which does not involve Split a string I'm very excited about the new update, especially with the arrays.
One way to do it is to paste the string in a notepad, do ctrl+home to be sure you’re at the beginning, hit ctrl+shift+right to select a whole word, cut it and store wherever you want., then repeat as needed.
Last Edit: Jan 30, 2021 13:38:07 GMT by philranger
1 | RUN ACTION | Split_String | "%txt%", "%STRINGX%", etc | Character to locate to make the cut | part before cutting %STRINGY% | part after cut % STRINGZ%
or instead of locating the character in the string to perform the cut, it could be by position. If we had a string with a length of 80 characters, we could do a function that cuts for example in the character 50 and in the 1st string we would have the first 50 characters and in the 2nd string the other 30 ......
Where is your original string located? Maybe you could split it from there as if it were in a notepad instead of copying it all at once? This would work for MS Word, Excel, any input box, etc.
I've tried doing something like this before, The issue I ran into was telling MMM where to make the cut. Can I ask how you have coded MMM to decide where to make the cut depending on what text it is looking at?
Firstly I’d like to thank you for all of the help you provide on this forum, always nice respectful and helpful, even on very basic repetitive questions.
I use 3 ways:
1- The simple one. - Alt-Tab to the window where my text source is - Ctrl-home to be at the beginning of the text - Ctrl-shift-right to select one word (or shift-down if I need the full line) - Ctrl-x to cut it so my text is ready for next pass. Sometimes I need to add a “delete” to remove a space or a line feed. - Decide in MMM what to do with the content of the clipboard - Repeat
2- same thing but if the delimiter is not a space I first replace all delimiters by a space (or a line feed if I want to use the full line selection method. I then replace all double delimiters by a single one a couple tomes just to be sure. If my sources are in text files, I use Notepad++ to pretreat them as it has the ability to do a replace for all of the files in a folder at once, as well as doing complex searches (special characters, regex, variable length search, etc. ) as well as its own macro system (limited to Notepad++ though)
3- I used to use MS-Excel and formulas or macros for the tokenization, but didn’t need it for quite a while now as I am getting better with MMM and Notepad++. Excel is a bit of a bummer as you cannot easily copy from it and expect just text as an output depending on where you paste. I often needed to first paste in a notepad, then re-copy from there. That’s just one of the reasons why being able to do alt-tab-tab would be nice ;-)
The string emerges as the code flows ,,,, let's say it is an http address ,,, example: http: // xxxxxxxx / xxxx / 5248759532
What I need is the number ,,,,,,, solution that I use:
1- pass the http address to a STRING
2- Open .txt and copy it there
3- I know the exact position of the number 4- with a LEFT CLICK DOWN from the initial position of the number, I move to the end, then LEFT CLICK RELEASE, with this I select the number
5- With a PRESSKEY CTRL + C, I copy the number
6- Then I designate a STRINGX what is in the CLIPBOARD
Haha ,,,, this works for me, but it is not what I want ... the idea would be not to have to interact with the txt file .... The program should only do it with a function .... That is where we should arrive ,,,, with steve's wit
my sincere thanks to all of you guys, for making this community have this level of dynamism
I really like it when I enter this forum and I see how many responses my comment has ...
Sorry if I say dumb stuff as I don’t know all of your variables...
In a notepad or something else: find “SKU”, escape, ctrl-shift-left, cut into an int variable, compare to plausible year span, find sku again (same one), ctrl-shift-right, cut into another numeric variable?
Its going to look like this at variable declaration:
In the STRING example we have CAT DOG FISH and we want them to be split by the delimiter of ' ' (a space) and assigned in sequence to string vars. In the CUSTOM VAR (%ANIMALS%) we have the same example, with edition of cow and goat.
1 | RUN ACTION | DEFINE STRING VARIABLE | %STRING%::test 2 | RUN ACTION | DEFINE STRING VARIABLE | %STRING1%:: 3 | RUN ACTION | DEFINE STRING VARIABLE | %STRING2%:: 4 | RUN ACTION | DEFINE STRING VARIABLE | %STRING3%:: 5 | RUN ACTION | DEFINE STRING VARIABLE | %STRING4%:: 6 | RUN ACTION | DEFINE STRING VARIABLE | %STRING1%::CAT DOG FISH::DELIM= ::LIMIT=0 7 | RUN ACTION | MESSAGE PROMPT | %string% %string1% %string2% %string3% %string4% * | Custom Vars *********************** 8 | RUN ACTION | DEFINE STRING VARIABLE | %STRING%::CAT DOG FISH COW GOAT 9 | RUN ACTION | DEFINE STRING VARIABLE | %ANIMALS%::%STRING%::DELIM= ::LIMIT=0 10 | RUN ACTION | MESSAGE PROMPT | %ANIMALS% %ANIMALS1% %ANIMALS2% %ANIMALS3% %ANIMALS4%
At line 1 we define string to test At line 2 through 5 we define string1/2/3/4 to be empty. This is so we can clear the vars for the test. At line 6 we define our string list. It reads like this: - Starting from STRING1 - Apply 'CAT DOG FISH', split by the delim of ' ' (a space) - Do not limit the variable assignment. At line 7 we output the result. Notice that the variable assignment started at string1 and went up to string3. STRING4 was still the empty variable. At line 8 we do the same thing using a custom variable name (custom variables are coming in the next version upgrade).
Now, this is just a quick implementation at this stage. I hope to add a little more to this. For now, so I can get this update out, Im going to keep it simple. Think it will work?