Jump to content

Opening files


Recommended Posts

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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...