Sign in to follow this  
Followers 0
jfcby

Open file & Run with specific program

8 posts in this topic

Hello,

Windows Media Player is not my default player for .m3u files.

How can I open a .m3u file to run in Windows Media Player?

I've tried:

Run("C:\Program Files\Windows Media Player\wmplayer.exe", "C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u")

Thank you for your help,

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites

Try:

Run("C:\Program Files\Windows Media Player\wmplayer.exe C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u")

Or:

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe","C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u")

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello,

Windows Media Player is not my default player for .m3u files.

How can I open a .m3u file to run in Windows Media Player?

I've tried:

Run("C:\Program Files\Windows Media Player\wmplayer.exe", "C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u")

Thank you for your help,

jfcby

You are passing the file path as the temporary directory parameter, so that's wrong. See the help file entry for Run().

Perhaps you were thinking of ShellExecute(), which is also in the help file:

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", "C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u", "C:\Documents and Settings\User\My Documents\My Downloads\KJBible", "Open")

:)

Doh! Three-eyed fish can type faster...

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

hehe. The ShellExecute example I posted doesn't work. THis does:

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))
Edited by Nahuel

Share this post


Link to post
Share on other sites

hehe. The ShellExecute example I posted doesn't work. THis does:

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))
Works Great!

Where would you add these command line parameters /open, /play, /new for Windows Media Player?

I've tried inserting them in code below and reading the help file but they did not work.

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u", "/Open"))

and

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", "/open", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))

and

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe /open", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))

Thank you for your help,

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites

Works Great!

Where would you add these command line parameters /open, /play, /new for Windows Media Player?

I've tried inserting them in code below and reading the help file but they did not work.

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u", "/Open"))

and

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", "/open", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))

and

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe /open", FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))

Thank you for your help,

jfcby

All of the parameters together form one string parameter:

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", "/open " &  FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

All of the parameters together form one string parameter:

ShellExecute("C:\Program Files\Windows Media Player\wmplayer.exe", "/open " &  FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u"))
For future reference purposes:

If you want to run, open, or execute Windows Media Player v 11 playing an audio file with command line options then tested working examples are below.

Run wmplayer v11 with no audio file but "Now Playing" tab selected...

ShellExecute("D:\Program Files\Windows Media Player\wmplayer.exe", "/Task NowPlaying", FileGetShortName("D:\Documents and Settings\James Cooper\My Documents\mp3\_KJVOldNewTeatament\_KJB.m3u"))

Run wmplayer v11 audio file playing with "Now Playing" tab selected...

ShellExecute("D:\Program Files\Windows Media Player\wmplayer.exe", FileGetShortName("D:\Documents and Settings\James Cooper\My Documents\mp3\_KJVOldNewTeatament\_KJB.m3u"))

Run wmplayer v11 audio file not playing with "Media Library" tab selected...

ShellExecute("D:\Program Files\Windows Media Player\wmplayer.exe", "/Task MediaLibrary", FileGetShortName("D:\Documents and Settings\James Cooper\My Documents\mp3\_KJVOldNewTeatament\_KJB.m3u"))

Run wmplayer v11 saved audio Playlist playing with "Now Playing" tab selected...

ShellExecute("D:\Program Files\Windows Media Player\wmplayer.exe", "/Playlist KJB_OldTestament")

Thank you for help,

jfcby

Edited by jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites

I've been using ShellExecute for a little utility to open a file or run a program at x y on screen. I don't see any mechanism for exception handling though. If I test the return value from ShellExecute, by the time I do a MsgBox() the system has already put up an error dialog with 8 lines of dense crud for the user to read, then my MsgBox comes up kinda' redundant.

Is there any way to trap system errors?

My app is not a Gui app. Just reads $CmdLine params and calls ShellExecute() then moves the window

after the program opens, then exits.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0