PDA

View Full Version : runing media player



MnInShdw
01-01-2002, 02:44 PM
I want to run windows media player , play some songs and while I have the song in the background continue with the rest of the script. I wrote the following:

dim wshshell
set wshshell = wscript.createobject("wscript.shell")
wshshell.run "D:\Media\my music\only.mp3",1,false
wscript.sleep 5000
...................
The problem is that there pops up an error and says that the path to the mentioned file can not be found. the path is ok. then I changed "My Music" folder's name to "MyMusic" and everything goes ok.
how can i specify a path containing space ( eg. My Music) to use run command

Any kind of hints would be a greatly appreciated.

thanx in advance

POBrien
01-01-2002, 06:15 PM
try using double quotes in the path

""D:\Media\my music\only.mp3""

MnInShdw
01-02-2002, 04:19 AM
thanx for your reply.

I did as what I was told and changed the statement to read :

wshshell.run ""D:Media\My Music\Believe.mp3 "",0,false

but no difference. Except the Error message keeps saying statement's structure is uncorrect. Line 3 , Columne 16 . That happens to be the secound quotation mark. I either changed the line to read :

wshshell.run "'d:\Medis\My Music\believe.mp3'",0,false

and the error chages to file can not be found at this path.

Is there any other possible way to do what i want?

thanx in advane.

darkness
01-07-2002, 02:24 PM
What is happening is that it cannot find a file with spaces in the path.. I will check on MSDN but if you say move the file to the drive root "c:\" then it works fine.

dim wshshell
set wshshell = createobject("wscript.shell")
wshshell.run "C:\11.luckystar.mp3",1,false
wscript.sleep 5000


This works just fine for me because it has no blanks spaces in the path. If you figure it out before me please post it back to the site here. Thanks!


Michael McLaughlin/images/forums/icons/smile.gif
Systems Manager
Minnesota State University Mankato

MnInShdw
01-07-2002, 04:17 PM
Hi Darkness,

thanx for your reply. I tested a lot of ways to made wscript recognizes the spaces in the path and I was able to find it.

Imagin there's a file at the following path:
c:\MnInShdw\My music\Rock Music\Elvis Prestly\haunt dog

for running this mp3 file it's enough to use 3 quotation mark in each side , as following :

wshshell.run """c:\MnInShdw\My music\Rock Music\Elvis Prestly\haunt dog""" , 0,false

and it works fine.

But the mistery still remains why 2 quotations is not enough , and what does the third one mean?

anyhow , thanx one more time for yor reply.

darkness
01-07-2002, 04:22 PM
Not a problem glad you figured it out.


Michael McLaughlin/images/forums/icons/smile.gif
Systems Manager
Minnesota State University Mankato