Only enabling button if exactly one movie file (.mkv, .mp4) and one .srt file are selected

I want to create a button that adds a subtittle track to a video file via ffmpeg. I want this button to only be clickable when exactly 2 files are selected: One supported movie file (so either .mkv or .mp4) and one subtitle track file (.srt [maybe I want to support .ass later])

I tried to do it via this modiifer:

@disablenosel:numfiles=2
@disablenosel:type=*.mkv|*.mp4
@disablenosel:type=*.srt

My logic being, disable the button when:

  1. Not exactly 2 selected files
  2. No .mkv or .mp4 selected
  3. No .srt selected

But the button still enables even if I only selected 2 srt files alone or 2 movie files alone. So this is not what I want. Is there a way to do this?

From what I can see the program will only consider the first disableonsel statement. The rest are ignored.

This is what I came up with:

@disablenosel:numfiles=2,type=*.(3gp|3g2|asf|asx|avi|f4p|f4v|flv|m1v|m2ts|m2v|m4v|mkv|mov|mp2|mp2v|mp4|mpe|mpeg|mpg|mpv|mpv2|mts|ogv|qt|ts|vob|webm|wm|wmv|srt)

The above code will only enable the button when a video is selected or when a srt file is selected.

Given how common videos are though, it may be wise to just drop the requirement for having a video file selected altogether and just require having an srt file selected.

@disablenosel:numfiles=2,type=*.srt

I'm not aware of any way to have it so that it only enables when once of each is selected aside from making a script.

Alternatively, if you have a label set for a video or you add something to the name like [tosub], it's possible to use @disableif to disable the button unless either the name contains tosub or it contain the label you specify.

1 Like