I have a dopus button (MS-DOS Batch Function button) with the following code:
youtube-dl {clip}
If I have copied a URL, all I need to do to download the video is to click on the dopus button to start the download.
Now...
youtube-dl features a -o flag where you can decide what you would like to call the downloaded video file. I would like to call the file the same as the parent folder name.
So for example, if I have the directory:
Cool movie\
Cool movie.mp4
I would like to run
youtube-dl {clip} -o "Cool movie"
So the question is, how can I get the parent folders name and use it in a batch-file button in dopus?
I'd recommend not using MS-DOS Batch mode at all unless you really have to. MS-DOS has all sorts of special cases with certain characters in file paths and command lines which can cause problems that are hard to understand when they happen.
You can use {sourcepath|nopath} to get the name (without path) of the current folder, and use the normal Standard Function mode to avoid all the MS-DOS issues.
Quoting the clipboard content is also a good thing to do in case there is a space in the text.
That should automatically quote the name if there is a space in the current folder's name, but you can also do it explicitly if that doesn't work (turning off automatic quoting to avoid ending up with two sets of quotes):
but if I set the button to run as a standard dopus function it seems to run the batch in a python.exe instead of cmd.exe, which does not work. I continue to struggle with this concept.
You could run it via cmd.exe but at that point you might as well use MS-DOS Batch mode since it's more or less the same thing.
I don't know about the particular tool or running Python scripts (presumably that's what it is?) outside of command prompts so there may be other ways.