Jump to content

Run VLC in fullscreen & do action at the end


Recommended Posts

Hi.

I did the following script:

$vlc = "C:\XP\VideoLAN\VLC\vlc.exe"
$file = "C:\XP\Start arcade\Intro.avi"
$file = " """ & $file & """"   ;because of the blanks in the path

$test = Run ($vlc & $file)
Sleep(300)   ;wait for VLC to be "really" opened
Send ("f")   ;set fullscreen

Sleep(14500)   ;wait for the video to be played
RunWait(@ComSpec & " /c " & 'taskkill /IM VLC.exe /T /F', "", @SW_HIDE)   ;close VLC

Run ("C:\XP\Start.exe")   ;run my programm

Exit

This is not smart at all in my opinion...

I tried several things:

$test = Run ($vlc & $file, "", @SW_MAXIMIZE)

This does not work with me. Maybe a syntax problem.

 

I replaced

Send ("f") ; (shortcut for "fullscreen" in VLC)

by

WinSetState($test, "", @SW_MAXIMIZE)

or

WinSetState("[ACTIVE]", "", @SW_MAXIMIZE)

But the problem is the same, I need to place

Sleep(300)

before these lines to make them work.

Besides, @SW_MAXIMIZE maximises only, but what I need is fullscreen.

Link to comment
Share on other sites

AutoIt is a tool for automating Windows tasks.  Due to the nature of Windows GUI engine, not everything can be accomplished through Windows API calls.  Sometimes you have to resort to mimicking user input.

Did Send( "f") work for you?  If so, then that is a good thing, correct?

Otherwise, you could just read the VLC documentation and note that there is a command line option to launch VLC in fullscreen mode...  (I googled "launch VLC in fullscreen mode" and had to read for about 10 seconds to get the answer)...  [grin]

Video options

  • --fullscreen ( or -f) sets fullscreen video.

Your Sleep( 300) is just telling the script to pause for 300 milliseconds so that VLC.exe can launch and be ready to accept user input.

Are you saying that if you launch VLC.exe manually, that it appears and is running in less than 300 milliseconds?  If so, you have the fastest PC on planet Earth.  In other words, I don't believe that the 300 millisecond pause is either extravagant or an unbearable burden to your script.

But you don't have to worry about the Sleep( 300) if you just use the VLC -f command line.

Note: Your Run( VLC) command returns a PID to your $test variable.  So you can use ProcessClose( $test) to kill your specific VLC process without having to shell out to a taskkill command.
 

Edited by cbruce
Link to comment
Share on other sites

@Jos
WinWait() works right for this, I tried.
But simply calling VLC like this is way easier:

$vlc = "C:\Arcade XP\VideoLAN\VLC\vlc.exe -f"

I was looking for a complicate way to do something easy...
Your info will be useful later for the beginner I am.
Thanks.


@cbruce
Yes the Send("f") trick did it.

With 300 milliseconds  the script worked, but you're right, maybe it's a bit short.
It was just for testing.
I didn't know the ProcessClose() command. Very useful. A big thanks!
It makes the scrips much easier.

So now I have this:
 

$vlc = "C:\Arcade XP\VideoLAN\VLC\vlc.exe -f"
$file = "C:\Arcade XP\Start arcade\Arcade XP.avi"
$file = " """ & $file & """"

$play = Run ($vlc & $file)

Sleep(14500)
ProcessClose($play)
Run("C:\Arcade XP\Start arcade\Start.exe")
Exit

 

Link to comment
Share on other sites

The only missing thing would be a command, who waits for the end of the video, to close the process.
In order to replace the Sleep(14500). If it's possible...
I'll have a look for that.

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...