Jump to content
Corsair Community

Is there any way to merge macros in CUE?


PlzDontHurtme
 Share

Recommended Posts

Have you looked into using two actions? e.g. One macro runs then another straight after.

 

In advanced mode CUE, Click the screwdriver and spanner to access the second action list.

 

This seems to make the second action run concurrently, not sequentially. (When I say these are long macros, run times are about 20 seconds each with sequences of about 60 keys per section.)

Link to comment
Share on other sites

This seems to make the second action run concurrently, not sequentially. (When I say these are long macros, run times are about 20 seconds each with sequences of about 60 keys per section.)

Understood and not unfortunately built into the software at present. Best bet is to edit the XML for now. It is easy to find the locations of the actions within an exported CUEProfile when you name them well.

 

You need to be careful about what you copy and be sure you append it or insert it in exactly the right place. You need to make backups before you start and I/the community can help you with particulars, but we all look forward to this feature being added into the program so that you can stack components so to speak. I haven't gotten around to doing this too frequently, but I am about to do so with a set of macros I almost always run in a row in excel and it hogs too many macro keys in my opinion, so i may post a quick tutorial on how I would go about that, unifying those actions.

 

You are definitely right that the second action runs concurrently and not after the first, which is a bummer, although in other instances may be helpful for some?

Link to comment
Share on other sites

...so i may post a quick tutorial on how I would go about that, unifying those actions...

So I tried this evening and got a good start. First attempt failed, but I realized it is more complicated than you might expect, you need to ensure the value tags inside the first tags are in a sequential increment-ing order or it will not validate when you try to import.

 

My solution was probably not the best and I need to ensure it works every time, but basically, it involved running a regex find replace with pattern matching:

^\t{15,16}<(/)*value(\d{1,2})>

to find the value tags as far nested as they were (but not further) with capture groups getting the value tag's numbers and then replacing with $1$2+13 which gave me 0+13,/0+13,1+13,/1+13... as the value tags incremented. You need the quantified repetition on the tab stops to ensure you do not bother with the nested value tags.

 

The next step was adding in the arbitrary base which equals the number after the highest value tag in the macro i am appending to, in my case was 12, so i put 13, and then went back through and it was easy enough to add the values together which reduced hundreds of lines of xml to a dozen or so.

 

running ^(/)*(\d\d) as match and <$1value$2> as replacement made it work after I had manually evaluated that math as appropriate (with no tabs it sticks out like a sore thumb on the left)

 

You can probably make a quick script to parse this text and evaluate those numbers (add them together) all at once...maybe even something as simple as selecting the range, running a notepad++ macro and using find next with a hotkeyed evaluation...I'll experiment as I've more of this to do for my purposes and my other examples are more than a dozen lines at a time...

Link to comment
Share on other sites

If the second macro runs concurrently with the first, can you put a header on it to delay the first action by the same amount of time as the first macro will run? Then even though the two will run concurrently, the second macro won't do anything until after the first finishes.

Good luck!

Link to comment
Share on other sites

If the second macro runs concurrently with the first, can you put a header on it to delay the first action by the same amount of time as the first macro will run? Then even though the two will run concurrently, the second macro won't do anything until after the first finishes.

Good luck!

 

That is actually a really smart idea! I would not have thought of that. Some macros however may trigger things outside of cue which may have a variable amount of time, so there could be some undue buffer. I really like your suggestion, I have not tried it, but I did spend some time today unifying hundreds of events inside of the XML and used the following AHK code and it worked flawlessly with some prepwork I will describe later.

 

I'm not a smart man so the code is pretty ugly, but it works great. Selected the xml events that needed the appropriate value tags reordered and hit ctrl alt shift h and it does it all for you after running the regex in the above tags (again, i plan on tidying up the whole event):

 

 

xmlCUEFixes(copy)

{

copy:=RegExReplace(copy, "m)[\t|\s]*$", "")

while RegExMatch(copy, "m)^(/)*(\d{1,3}\+\d{1,3})$",tempVar)

{

tempVar:=RegExReplace(tempVar, "/", "")

tempVar:=Eval(tempVar)

copy:=RegExReplace(copy, "m)^(/)*(\d{1,3}\+\d{1,3}$)", tempVar,,1)

}

copy:=RegExReplace(copy, "m)(</ptr_wrapper>[\r\n|\n|\r]*)(\d{1,3})","$1 </value$2>")

copy:=RegExReplace(copy, "m)^(\d{1,3})"," <value$1>")

return copy

}

Eval(x)

{

StringGetPos i, x, +, R

Return Left(x,i)+Right(x,i)

}

Left(x,i)

{

StringLeft x, x, i

Return x

}

Right(x,i)

{

StringTrimLeft x, x, i+1

Return x

}

obtain()

{

Send, ^c

sleep, 60

copy:=clipboard

return copy

}

deliver(copy)

{

clipboard:=copy

sleep, 60

Send, ^v

sleep, 60

}

^+!H::

copy:=obtain()

copy:=xmlCUEFixes(copy)

deliver(copy)

return

; check this out...RegExReplaceInc()

Link to comment
Share on other sites

 Share

×
×
  • Create New...