Jump to content
Sign in to follow this  
Khryus

Opening files

Recommended Posts

Khryus

Hello,

How would you have VLC or WMP (windows media player) to open a video file via autoit? Would you use Run?

Thanks in advance :oops:


"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
Khryus

I don't know how to use ShellExecute to work with VLC or WMP, also, shouldn't the script/executable be inside VLC's or WMP's folder to work?

I've got to go now, I'll check this tomorrow. Thanks for the help in advance :oops:

Edited by megablox

"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
czardas

ShellExecute() will open a media (or other type of) file using the default program. If you want to select a different program then it wouild require more code. You don't need to put the script inside any particular folder, but you do have to give the full path of the file you want to open (in this case the path to the media file).

Edited by czardas

Share this post


Link to post
Share on other sites
Khryus

Thanks, it's working! But I need to make it so that you can choose which program you want to open the file with, so could you tell me what I have to do in order to do that? (don't need code, just some tips on how to do that)

Edited by megablox

"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
hawkair

Hi I have not much experience but for me this seems to work

$vlc = "C:Program FilesVideoLANVLCvlc.exe"
$kmp = "C:Program FilesThe KMPlayerKMPlayer.exe"
$file = "d:My Moviesafterschool.xvid-lpd.avi"
$file = " """ & $file & """" ;because of the blanks in the path
Run ($vlc & $file )
Run ($kmp & $file )
Exit
Edited by hawkair

Share this post


Link to post
Share on other sites
Chimaera

Is there a reason that you need a different program to open it?

ShellExecute() uses whatever the default option is that is set in windows, which is usefull when your intended target prefers one program over another

If its just for yourself just right click a movie file and choose open with, check the set as default box and choose the program you want, then just use ShellExecute() and it will always use that program.

Share this post


Link to post
Share on other sites
Throne3d

Right, I managed to help MegaBlox. He wanted to be able to select in his AutoIt GUI which player, because... he's awkward. xD

He was using a bit of ugly hax to do it, and basically created a cmd.exe window, then wrote the command into there, but I changed that to a ShellExecute method for him, and managed to make it work for VLC by doing a third argument, the working directory ("C:Program Files (x86)VideoLANVLC"). The second bit, the arguments with which to run the program, I looked at advanced methods of running VLC and found out you could specify a file there, as with WMPlayer, and you could also do fullscreen.

So yeah, I think this is all fine now. :oops:

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  

×