I want to use ruby run excute mp3 file,but I don't know how to get it
work。
I have a song on D drive and I write a callme.rb
++++++++++
def callme
system("2k7.mp3" )
end
callme
+++++++++
I am run "ruby callme.rb" in "CMD"
but didn't run the 2k7.mp3 song
why? how shoud I do it right?
my system is windows XP
The Rails plugin, ActsAsHasselhoff[1], provided a way to do this from within Ruby on Rails. Might be worth looking over the code[2].
system( "start \"G:\\Itunes_To be imported\\02 - Anne Clark - The
Power Game.mp3\"")
otherwise the start command considers only the first "word" as the
command to execute,
and the rest are parameters to that command.
Note: due to ****** (censored) design of the start command, any time
you need to quote the command,
you have to add "" in front of it, otherwise the command ends as the
window title. So the final version is:
system( "start \"\" \"G:\\Itunes_To be imported\\02 - Anne Clark - The
Power Game.mp3\"")
Jano
···
On Feb 17, 2008 5:01 PM, Adam Akhtar <adamtemporary@gmail.com> wrote:
Hi im having a problem playing a song. Im basically got this is my file
system( "start G:\Itunes_To be imported\02 - Anne Clark - The Power
Game.mp3")
and then running it from within Radrails.
Its keeps complaining "Windows cannot find the file 'G:\Itunes'....."
What am i doing wrong? (The song definately is in that path as i copied
its path from its properties)
Or just use single quotes (or %q{start G:\blah.mp3}) rather than
double quotes if you don't need to interpolate the string. That will
make it easier to read than the extra \'s.