Handling an "optional" dialogue in VLC

Is there a neat way to do this?

I want to play an MP4 file using the VLC app. Let's call the file “video.mp4”.

I can do this by using the open file name action specifying”video.mp4” and the application to be VLC

I want to play the mp4 from the beginning.

If I have not played the file before then it works fine.

However, if I have PARTLY played the file before, VLC pops up a dialogue saying
A: do I want to restart from the beginning or
B: Continue from where I left off?

I want to restart, so I could use the VLC jump to 0.00 position action.

What is the best way of handling this “optional” dialogue?

I ask this as there must be a generic good practice of handling "optional" dialogue.

How about avoiding it completely?

In VLC settings you can stop VLC trying to continue playback from where you left off like this:

However, while this is fine if you never want to resume playback, but if you do you might need to resort to AppleScript (since VLC has good AS support) or even run VLC from a shell script using command-line parameters - but I haven't investigated those options...

2 Likes

Actually in terminal, run this command to get the VLC command line options:

/Applications/VLC.app/Contents/MacOS/VLC --help

From that you can work out the command you want:

/Applications/VLC.app/Contents/MacOS/VLC --start-time 0 <path to video file>

I haven't actually tried that last command out, so YMMV!

2 Likes

Just to add another option to the mix, I use the following method to dismiss certain irritating alerts in Logic Pro:

Trigger on front window change
If button with a certain name exists, click it

I mention may come across this thread trying to find a solution for a similar problem involving occasional alerts in another context.

@tiffle's got the better answers, but you could also play off the fact that VLC's dialog is actually a window -- count the number of windows before you open the video, open the video, pause until the WINDOWCOUNT() is greater than (previous window count + 1) then click the found image of the restart button.

This works because the pause condition has a 2 second, abort without notification, timeout so that if the dialog doesn't appear the macro will quickly cancel itself:

Open in VLC with restart.kmmacros (19.2 KB)

Image

The general pattern would be "see if a dialog shows up then deal with it" -- but is so broad as to be practically useless :wink: Everything else is situational -- if it's a "proper" Mac app with "proper" Mac dialogs you could pause until a button exists (again with an appropriate timeout), you could hard-code a pause then test to see if there's a dialog, if you don't know when the "optional" dialog might appear and want your original macro to continue you could spawn an asynchronous background macro that used button- or image-detection... And I see @noisneil's just suggested a completely separate macro, triggered by front window changes.

1 Like

Thanks to everyone who has contributed.
I have now set the option to ALWAYS continue playback, so the dialogue never comes up (Thx Tiffle)
I will then use Jump to position zero to restart the playback.

1 Like