Old 10-06-2019, 03:19 PM   #1
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default Open Midi File with Different Extension [SOLVED]

I just want to open song.seq that is a midi file with an .seq extension.
Can I do this without doing a shell copy command
cp song.seq song.mid
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak

Last edited by MusoBob; 10-07-2019 at 01:49 PM.
MusoBob is offline   Reply With Quote
Old 10-07-2019, 02:40 AM   #2
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

I think I will just read and write it to a midi file

This works and I get
Song.seq.mid
but I would like Song seq.mid
if I do a gsub on source_filename then file:write(source_content) don't work.
Code:
retval, source_filename = reaper.GetUserFileNameForRead("", "Choose SEQ File", "seq")
file = io.open(source_filename, "rb")
source_content = file:read("*all")
file = io.open(source_filename ..".mid", "wb")
file:write(source_content)
file:close()
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 10-07-2019, 01:48 PM   #3
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

This did it
Code:
retval, source_filename = reaper.GetUserFileNameForRead("", "Choose SEQ File", "seq")
file = io.open(source_filename, "rb")
source_content = file:read("*all")
source_filename = string.gsub(source_filename, ".seq$", " seq .mid")
file = io.open(source_filename", "wb")
file:write(source_content)
file:close()
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.