Sign in to follow this  
Followers 0
photonbuddy

Launching media files easily

6 posts in this topic

Hi All,

I have written a program I use on DVD's with movie files on it, that scans the DVD and then brings up a GUI with a button to launch each media file found.

It works fine on my system, where I have media player classic installed and set as default media player.

Tonight, however, I took one of my DVD's to a friends place who is running XP media centre (I run Win2k), and the program would not launch properly.

When clicking a button, media player would load, but would not load in the media and play it.

Currently I test for a few media types and play them thus:

Select
                Case StringRight($filename, 3) = "AVI"
                    $sType = RegRead('HKEY_Classes_Root\.avi', '')
                    If $sType <> '' Then $sCommand = RegRead('HKCR\' & $sType & '\Shell\Open\Command', '')
                    If $sCommand <> '' Then $sCommand= (StringReplace($sCommand, '"%1"','"'&$filename&'"'))
                    $mplayer = $sCommand
                Case StringRight($filename, 3) = "MPG"
                    $sType = RegRead('HKEY_Classes_Root\.mpg', '')
                    If $sType <> '' Then $sCommand = RegRead('HKCR\' & $sType & '\Shell\Open\Command', '')
                    If $sCommand <> '' Then $sCommand= (StringReplace($sCommand, '"%1"','"'&$filename&'"'))
                    $mplayer = $sCommand
                Case StringRight($filename, 3) = "WMV"
                    $sType = RegRead('HKEY_Classes_Root\.wmv', '')
                    If $sType <> '' Then $sCommand = RegRead('HKCR\' & $sType & '\Shell\Open\Command', '')
                    If $sCommand <> '' Then $sCommand= (StringReplace($sCommand, '"%1"','"'&$filename&'"'))
                    $mplayer = $sCommand
                Case StringRight($filename, 3) = "MOV"
                    $sType = RegRead('HKEY_Classes_Root\.mov', '')
                    If $sType <> '' Then $sCommand = RegRead('HKCR\' & $sType & '\Shell\Open\Command', '')
                    If $sCommand <> '' Then $sCommand= (StringReplace($sCommand, '"%1"','"'&$filename&'"'))
                    $mplayer = $sCommand
            EndSelect
            $mp = $mplayer & " "
            If GUICtrlRead($fs) = $GUI_CHECKED Then
                $mp = $mp & "/fullscreen "
            EndIf
            RunWait($mp)

(I got the basis for this code from another post here, but I can't find that post now)

What I'd really like, is a way to simply pass the filename to a function, and get back the appropriate command line from the function to run that media type.

Any ideas?

Share this post


Link to post
Share on other sites



I was looking for something like this for a long time. I'll certainly will give it a try and then adapt my own version very soon


Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

(I got the basis for this code from another post here, but I can't find that post now)

What I'd really like, is a way to simply pass the filename to a function, and get back the appropriate command line from the function to run that media type.

Any ideas?

DOS/Windows command "start" will take care to start the correct application, if the media type is "known/registered" in windows

(commands: assoc and ftype)

#include <Process.au3>
$myfile= "C:\temp\movie1.mpeg"
$rc = _RunDos("start " & '""' & $myfile) ; we need the '""', don't remove it !!
Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

ShellExcecute() :)

damn, I allways forget about that ... :">


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Thanks for the ShellExecute() option.

ShellExecute() seems to work, but it doesn't appear to pass the paramters correctly.

Specifically:

$param=""
            If GUICtrlRead($fs) = $GUI_CHECKED Then
                $param = "/fullscreen"
            EndIf
            ShellExecuteWait($filename,$mp)

Doesn't launch the program in fullscreen mode.

Mind you, I think this may be a problem with Windows, as if I use the run box and type in "<media file> /fullscreen" it doesn't work either. If I put the actual media player command in front of the media file name, it runs fine in full screen.

Any suggestions for a fix for this?

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