Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
EASY Task?
#1
Heart 
Dear all,

I am new to Quick Macros and I love this program by now. As trying to play with it I got the following issue. I got a string from my macro that contains a duplicated string. I need to detect those and delete the second part. How to do it?

str s = "repeatable stringrepeatable string"
int n
for n 0 s.len
    out s.left(s n)

Even the for loop does not work... Why? How to find a solution?

Best regards

Gregor Heart
#2
Quote:I am new to Quick Macros

Try LibreAutomate. It is similar to Quick Macros.

-----

Easy if the substring is known.
Example in LibreAutomate:

Code:
Copy      Help
// script ""
string s = "repeatable stringrepeatable string";
if (s.RxFindAll(@"repeatable string", out var matches) && matches.Length > 1) {
    for (int i = matches.Length; --i >= 1; ) {
        var m = matches[i];
        s = s.Remove(m.Start..m.End);
    }
}

print.it(s);
#3
I'm sorry if I crossed a line. As an admin, why are you offering the free version instead of Quick Macro? And does ChatGPT really help in creating scripts for MacroQuest or LibreAutomate?

Because I have zero knowledge about programming languages, and my best 24-hour teacher is ChatGPT.
#4
LibreAutomate is a replacement for Quick Macros. It is better in many ways. Quick Macros now is a legacy app.

ChatGPT is not very familiar with LibreAutomate and QM. But in LibreAutomate you use C#, and ChatGPT can help much.
#5
I tested how ChatGPT can answer the topic question.
In C# (LibreAutomate) the code is working, although the result isn't exactly what we need. I would give it score 7 / 10.
In QM it is far from valid and working. Score 3 / 10.

https://chatgpt.com/share/6723062f-e7b8-...b0c12b6098
#6
Your for loop doesn't work because as soon as you do this
out s.left(s n) when n =0 s is now empty and any further attempts after will have no value
need to store the string in a new string
 
Code:
Copy      Help
str s = "repeatable stringrepeatable string"
int n
for n 0 s.len
,out _s.left(s n+1)


Forum Jump:


Users browsing this thread: 2 Guest(s)