Here’s the python code. Enjoy. :)
This code needs to import nwctxt.py see https://github.com/nwsw/nwc2ut-python
Love and peace,
Joe
"""joeSelReverse.py Reverses the Notes that are selected in a NoteWorthy Composer staff
see:
https://github.com/nwsw/nwc2ut-python
"""
import sys
# import joeNWCtxtInPythonNew as nwctxt
import nwctxt # see https://github.com/nwsw/nwc2ut-python
import logging
logging.basicConfig(filename='joeNWC_PY.log',level=logging.DEBUG) # DEBUG => print ALL msgs
clip = nwctxt.NWC2Clip()
PlayContext = nwctxt.NWC2PlayContext()
txtItemL = clip.Items
clipItemL = [nwctxt.NWC2ClipItem(txtItem) for txtItem in txtItemL]
first2 = clipItemL[:2]
reversedClipItemL = first2 + list(reversed(clipItemL[2:]))
reversedTextItemL = [item.ReconstructClipText() for item in reversedClipItemL]
print clip.GetClipHeader()
for textItem in reversedTextItemL[2:]:
#print "clipItem.GetObjType()= %s, type(clipItem.GetObjType())= %s, "%(clipItem.GetObjType(), type(clipItem.GetObjType()))
print textItem
print clip.GetClipFooter()
# TO DEBUG uncomment below to report to NWC STDOUT DIALOG & to CAUSE NO STAFF MODIFICATION
# sys.exit(nwctxt.NWC2RC_REPORT)
This code needs to import nwctxt.py see https://github.com/nwsw/nwc2ut-python
Thanks for the link.
nwctxt.py made for interesting reading. Much cleaner than the PHP library. I've not used python so there is not much more I can say. I've resolved to upgrade beyond WinXP before taking on any new languages.
Thanks for the comment, Rick.
Much cleaner than the PHP library.
For me, Python reads easier than any of the other languages I use.
Eric's nwctxt.py is an example.
Thanks again, Rick.
Love and peace,
Joe