Wikipedia:Reference desk/Archives/Computing/2018 June 16
Computing desk | ||
---|---|---|
< June 15 | << May | June | Jul >> | June 17 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
June 16
[edit]How do I pass a file name as an argument to wmplayer.exe (Windows Media Player)
[edit]If I run wmplayer.exe from a "Command Prompt" window is there a way to pass the name of a MIDI file as an argument to wmplayer.exe so that it plays it? If you're wondering "Why?" (since in the "Command Prompt" typing the name of the MIDI file by itself will start the Windows Media Player anyway), it is because I'm trying to do it from Python. In Python there is a call subprocess.run() where you can pass the name of the program as first argument and the arguments to be passed to the program as a second argument. I need to do it this way because if I try subprocess.run("<MIDI file name>") Python objects that "<MIDI file name>" is not a Windows executable. Any ideas? Thanks. (I'm running Windows 7) Basemetal 00:37, 16 June 2018 (UTC)
- If you invoke
explorer MyAudoFile.midi
, then the registered.midi
will run asif the user had double-clicked on the file. LongHairedFop (talk) 13:25, 16 June 2018 (UTC)- It worked beautifully. Thank you LongHairedFop. A small correction to what I said above: you don't pass two arguments to subprocess.run(), you pass the whole "command" as first argument thus: subprocess.run("explorer.exe my_MIDI_sequence.mid"). The subprocess.run() can take other arguments (though for now one argument serves my purpose) for which see the Python library documentation, specifically module subprocess. Basemetal 14:16, 16 June 2018 (UTC)
- The correct way to use subprocess is
subprocess.run(["explorer.exe","my_MIDI_sequence.mid"])
: the command name and its arguments are all elements of one long list. (This makes unfortunately little difference on Windows because of its simplistic command-line mechanism.) --Tardis (talk) 16:36, 16 June 2018 (UTC)
- The correct way to use subprocess is
- It worked beautifully. Thank you LongHairedFop. A small correction to what I said above: you don't pass two arguments to subprocess.run(), you pass the whole "command" as first argument thus: subprocess.run("explorer.exe my_MIDI_sequence.mid"). The subprocess.run() can take other arguments (though for now one argument serves my purpose) for which see the Python library documentation, specifically module subprocess. Basemetal 14:16, 16 June 2018 (UTC)
Looking for a small program that will play MIDI files in Windows 7
[edit]Do you know of a small program that will send a MIDI file (.mid) to an external MIDI sound module, etc. in Windows 7? Any DAW, or Windows Media Player, will of course play MIDI files, but I'm looking for something very small and simple that will just play the MIDI file and then exit. Thanks. Basemetal 00:41, 16 June 2018 (UTC)