Button to play selected mp4s or all files in folder if none selected

Hello friends, once again, coming to the knowledge trough. Hopefully not complicated, but can't find the right option to make it do what i want.

I have a button that plays all highlighted files in VLC -- > "C:\Program Files\VideoLAN\VLC\vlc.exe" {allfilepath}

I'd like this same button to do that AND if I have nothing selected play all the files within the folder. Is this possible?

Thanks guys/gals :grin:

Try

@nodeselect
=return "/programfiles\VideoLAN\VLC\vlc.exe " + (selfiles > 0 ? "{allfilepath}" : "{sourcepath}")
2 Likes

Ok, so that opens up VLC, but it cues up the highlighted folder in my folder tree and then VLC wont play it, it just sits there. I checked the playlist and it just lists the folder, but oddly enough there is an extra " at the end of the folder name and I think that may be screwing it up... What do I need to alter in the code to get rid of that? I included a screenshot of the player and playlist that opens upon pressing the button below.

Works here in a test folder with media files and VLC 3.0.21.

Does something like this work on your system?

"/programfiles\VideoLAN\VLC\vlc.exe" D:\testfolder

Is the focus on the file display or elsewhere (like the folder tree)?

no, that opens VLC, and it has a file named "testfolder" in the playlist that it repeatedly tries to play over and over without success
I am inside of the folder i want to play the files within, and no files are selected

With your first vlc code, if i highlight a file, that one comes up in the playlist and works fine, but if I don't have anything highlighted, i get the folder trying to play with a " at the end of it. Keeps trying to play it over and over again.

OK WAIT I tried again and your second code DOES work. I apologize I was being stupid. How can I use this for the original button?

Let's try without the trailing backslash and write {sourcepath|noterm}.

I feel so stupid, but there is no trailing backslash on any of you code that I can see, is there? Not in your first or second batch of code... and I am going to replace

@nodeselect
=return "/programfiles\VideoLAN\VLC\vlc.exe " + (selfiles > 0 ? "{allfilepath}" : "{sourcepath}")

with this

@nodeselect
=return "/programfiles\VideoLAN\VLC\vlc.exe " {sourcepath|noterm}

or

"/programfiles\VideoLAN\VLC\vlc.exe" {sourcepath|noterm}

noterm Strips the trailing path separator from the returned path. For example, {sourcepath|noterm} might return C:\Program Files\GPSoftware\Directory Opus.

From : Codes for passing paths [Directory Opus Manual]

Thank you so much for working through that with me. Sorry I haven't responded earlier, I had a death in the family and have been up to me neck with all kinds of terrible nonsense. The third option above successfully works for me just as I requested, however, the second option throws a
" Error at line 1, position 58
Unknown value (6): noterm"
In the log file.

Just for anyone's future knowledge. Again, thank you so much!