nwbyy Posted July 24, 2017 Posted July 24, 2017 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.
nwbyy Posted July 24, 2017 Author Posted July 24, 2017 So is there any way to set VLC on fullscreen directly? If not, can I at least replace 'Sleep(300)' by a condition saying "when VLC runs", then 'Send ("f")'?
Developers Jos Posted July 24, 2017 Developers Posted July 24, 2017 On 7/24/2017 at 6:11 PM, nwbyy said: by a condition saying "when VLC runs", Expand WinWait() ? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
cbruce Posted July 24, 2017 Posted July 24, 2017 (edited) 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 July 24, 2017 by cbruce
nwbyy Posted July 24, 2017 Author Posted July 24, 2017 @JosWinWait() 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
nwbyy Posted July 24, 2017 Author Posted July 24, 2017 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.
cbruce Posted July 24, 2017 Posted July 24, 2017 nwbyy, just add the VLC command line option '--play-and-exit' and forget the Sleep(14500) and the ProcessClose().
nwbyy Posted July 24, 2017 Author Posted July 24, 2017 Okay nice. Here is the final code. $vlc = "C:\Arcade XP\VideoLAN\VLC\vlc.exe -f --play-and-exit" $file = "C:\Arcade XP\Start arcade\Arcade XP.avi" $file = " """ & $file & """" $play = Run ($vlc & $file) ProcessWaitClose($play) Run("C:\Arcade XP\Start arcade\Start.exe") Exit Thanks again for your help.
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