Hi folks!
I think I ran into a dead end and hope you can show me a hidden path out of it :D.
Possibly my lack of understanding how to properly work with the [Mem] functions, is a big part of this issue.
What I want to do:
For a script I am currently working on I want to add/or subtract Subtools from a list.
If it is not yet part of the list, add it - otherwise remove it.
Currently I do this by:
-[StrFind] if the currently selected Subtool is part of the list
If not:
-[StrMerge] padded with a few special characters to prevent mixups, to the list
If already present:
-Exclude by splitting the list in two (before and after the entry) and [StrMerge] the two pieces back together again.
Adding and removing this way actually works pretty well!
My problem:
The problems start to arise though, when the list of Subtool names gets too long. Sofar I stored the list in a “normal” variable, but already knew that I had to move them to memory at some point.
Usually I do this using MVar, but I suppose the limits for them are the same as for normal variables.
Because of this I wanted to work with the [Mem] functions. But I can’t wrap my head around how to properly work with them.
I can store/increase/read their size, but that is as far as I got :(.
Is there a way to compare a new string, with what I have stored into a memory block?
Like [StrFind,newName,[MemReadString,storedNames]]?
I came across this thread in which Marcus describes, how to add items to a list stored in memory and write it to a .txt file.
This way I was able to write my list to a file and it really worked well!
But I got stuck again, as I could not find a way how to compare with the string stored in the .txt file.
I played around with [MemCreateFromFile] and it’s size increased when the list got longer, but then I found myself having the same issue as before:
How do I compare with data stored in memory?
Ideally I would not want to write a file anyway. This sounds like a pretty costly operation, so preferably I would only want to compare with data temporarily stored in memory.
So any help would be much appreciated!