daedo Posted October 10, 2013 Share Posted October 10, 2013 I am new to Autoit having used autohotkey before. I am stuck on how to select a video file and play it with mplayer, I searched the forums but couldnt find the answer. here is my simplified script #include <GUIConstants.au3> #include <String.au3> #include <Array.au3> #include <Constants.au3> #include <File.au3> ;global $playingfile = '"C:\some file.mp4"' global $selectedfile = FileOpenDialog ( "open","","All (*.*)") ;$mplayerpid = Run ( "mplayer.exe -slave -quiet " & '"C:\some file.mp4"' );this works ;$mplayerpid = Run ( 'mplayer.exe -slave -quiet ' & $playingfile ); this works $mplayerpid = Run ( 'mplayer.exe -slave -quiet ' & '"'& $selectedfile &'"' ); this and many variations doesnt The problem is selecting the file, taking account of the fact it and / or the path may have a space in it so it must have quotes around it to work I have remarked out 'fixed' options that do actually work Thanks in advance for any help Link to comment Share on other sites More sharing options...
gruntydatsun Posted October 10, 2013 Share Posted October 10, 2013 (edited) $mplayerpid = Run ('mplayer.exe -slave -quiet "' & $selectedfile & '"') should work fine. can you go Start>Run>mplayer.exe and it launches mplayer? perhaps mplayer is not on your PATH environment variable. Try pointing directly to the mplayer executable: $mplayerpid = Run ('C:\path\goes\here\mplayer.exe -slave -quiet "' & $selectedfile & '"') or if there's spaces in the path to your mplayer.exe $mplayerpid = Run ('"C:\path with spaces\goes\here\mplayer.exe" -slave -quiet "' & $selectedfile & '"') Edited October 10, 2013 by gruntydatsun Link to comment Share on other sites More sharing options...
daedo Posted October 10, 2013 Author Share Posted October 10, 2013 Many thanks gruntydatsun,, the problem was pointing to mplayer, it was in the working directory, but the full path sorted it Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now