Okay, I just rewrote this whole thing in Python and now it can handle more than one pattern. Here's the Python 3 script, reverse.py:
#!/usr/bin/python3
# OpenMPT clipboard reverser by Saga Musix in 2017 (Public Domain / CC0)
import sys
if(len(sys.argv) != 3):
print("Usage: " + sys.argv[0] + " infile outfile")
sys.exit()
lines = list(open(sys.argv[1]))
f = open(sys.argv[2], 'w')
# ModPlug signature
f.write(lines.pop(0))
# Reverse order list if present
if(lines[0][:8] == "Orders: "):
f.write("Orders: " + ",".join(reversed(lines[0][8:-1].split(","))) + "\n")
lines.pop(0)
# Reverse patterns
pattern = list()
for line in lines:
if(line[0] == "|"):
pattern.append(line)
else:
f.write("".join(reversed(pattern)))
pattern = list()
f.write(line)
f.write("".join(reversed(pattern)))
You will need Python 3 to run this, typically this comes pre-installed on Linux, on Windows you have to download the Python interpreter first.
To use it, copy some pattern data or multiple patterns in OpenMPT to the clipboard. Paste it into a text editor and save it, then run "python reverse.py infile.txt outfile.txt" on the command line (substitute the names of those text files of course). Then open the output file in a text editor, copy it and paste it back into OpenMPT.
Note: If you copy more than one pattern, current OpenMPT versions will get a bit confused. You need the latest test version (r7547 or later, soon available from
https://buildbot.openmpt.org/) in that case so that the clipboard data is parsed correctly.
I hope this helps! It's not very luxurious but then again this is probably not a feature you need every day.