OPTIONS "C_CALL LABELCHECK NOSOURCE"
LIBRARY rexxgui, rxmidi
midierr = "ERROR"
midiheading = 1
IF guisay('This script sets all track name events to "Track XX" where XX is the track number. Proceed?', 'YES|INFO') \= 'YES' THEN SIGNAL out
IF ARG() < 1 THEN DO
ERROR = guifile('FromFilename', 'EXISTING', 'Enter a name for the new MIDI file', 'MIDI files (*.mid, *.rmi) | *.mid;*.rmi | All files (*.*) | *.*')
IF ERROR \= "" THEN SIGNAL out
END
ELSE fromfilename = ARG(1)
IF ARG() < 1 THEN DO
ERROR = guifile('FromFilename', 'EXISTING', 'Enter a name for the new MIDI file', 'MIDI files (*.mid, *.rmi) | *.mid;*.rmi | All files (*.*) | *.*')
IF ERROR \== "" THEN RETURN
END
ELSE fromfilename = ARG(1)
DO
MIDIOpenFile(fromfilename)
DO WHILE MIDITrack("") \= 0
DO WHILE MIDIGetEvent('Trac') = ""
midievent.!data1 = "Track" MIDITrack()
MIDISetEvent('DATA')
END
END
CATCH ERROR
CONDITION('M')
END
RETURN |