Possible to mark files in specific (non-alphabetic) order?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
gewone
Junior Member
Junior Member
Posts: 66
Joined: 2008-03-06, 17:37 UTC

Possible to mark files in specific (non-alphabetic) order?

Post by *gewone »

Hi guys!

I have made a simple script in my DEFAULT.BAR that concatenates multiple MPEG-4 files into one by appending them; I use this to "losslessly" (by stream-copying) transform short (e.g. Snapchat / Instagram / Messenger) clips into longer videos. Pretty neat, huh? ;)

Anyways, my script uses %S for parameter, which I found by the Help. Unfortunately, it took me a while to figure out that I'm not supposed to mark the .MP4 files and drag them to the shortcut I've made in my top bar; this way it only takes the first marked file as %S parameter. Fortunately, I soon realized that the right way to go is to mark all the files and then just click my shortcut.

Now, I'm only missing one little thing for perfection. Namely, a way for the "parsing" not to just grab the marked filenames in alphabetic order. Say I have a.mp4, b.mp4 and c.mp4, it would be cool if there was a way to mark "c.mp4", followed by "a.mp4", and last but not least "b".mp4", and then get my concat:ed output to be made in this order.

Right now it doesn't matter which way I select the files, it ends up merging them alphabetically. I'm guessing this is due to the very core nature of how Total Commander works, which is maybe hard to get by, but I'm just throwing in a Hail Mary pitch here, maybe someone has a delicate but relatively easy solution to solve my issue, perhaps some Single button %parameter that I'm not aware of, that could help me?

Cheers!
Last edited by gewone on 2020-05-07, 08:49 UTC, edited 1 time in total.
User avatar
Hacker
Moderator
Moderator
Posts: 13065
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Possible to mark files in specific" (non-alphabetic) order?

Post by *Hacker »

gewone,
The files should be sorted by their order as they appear in the file panel. Perhaps you could try to rename them to 1c.mp4, 2a.mp4 and 3b.mp4?

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Possible to mark files in specific" (non-alphabetic) order?

Post by *Stefan2 »

gewone wrote: 2020-05-04, 11:15 UTC
Anyways, my script uses %S for parameter,

Maybe use an %L parameter, which creates a temporary file with all selected files.
In your script take the timestamp of that temp file, open it in Notepad,
sort to your wish, save and let your script continue if the timestamp have changed.



Script examples (w/o your special issue)

Powershell -Example

Code: Select all

 Cmd=Powershell 
 Param="%L"
# // The script
# // Check arguments:
If ($Args.Count -eq 0) { "Please use '%L' as TCs parameter. Also select one or more files first. Script quits here."; return}
# //DEBUG:
# Notepad $Args[0]
# //Do the WORK:
 TYPE $Args[0] | ForEach{ ...}
VBS-Example

Code: Select all

Set FSO  = CreateObject("Scripting.FileSystemObject")
Set WSO  = CreateObject("WScript.Shell")
sTCtempList = Wscript.arguments.Item(0) ' The TC temp file due the "%L"
  If  FSO.FileExists(sTCtempList) Then
      WSO.run "notepad " & sTCtempList
      Set oTextStream = FSO.OpenTextFile(sTCtempList,FORREADING)
      Do Until oTextStream.AtEndOfStream
      ...
      Loop
      oTextStream.Close
   Else
      WScript.Echo "Input file  sTCtempList  not found."
   End If
AHK-Example

Code: Select all

vTCtempfile=%1%
Loop, Read, %vTCtempfile%
{
    vCurrTempFileLine = %A_LoopReadLine%
    MsgBox Curr line is:`n%vCurrTempFileLine%
}


 
User avatar
gewone
Junior Member
Junior Member
Posts: 66
Joined: 2008-03-06, 17:37 UTC

Re: Possible to mark files in specific" (non-alphabetic) order?

Post by *gewone »

Thanks @Hacker & @Stefan2 for your quick responses, much appreciated!

The method of renaming the the files before punching the triggering button is of course one solution, and the scripting is another possibility. However, after (due to your response) concluding that there is no elegant built-in way of achieving what I'm looking for, I ended up with two buttons next to each other.

The first one:

Code: Select all

Command: cmd.exe /c
Parameters: "echo file '%S' >> %%tmp%%\concatx.lista"
The second one:

Code: Select all

Command: cmd.exe /c
Parameters: "ffmpeg.exe -f concat -safe 0 -i %%tmp%%\concatx.lista -c copy -v quiet output.mkv & del %%tmp%%\concatx.lista"
Now, I just click the first button for every file I want to include in my concatenated chain of input, and when I feel I have all my footage clips added in desired order, I click the second button, which executes the punch and finally wipes my "list" so that my computer is ready for the next new one.

Besides ending up with two bar buttons instead of one, this feels like the simplest solution to my problem; me not needing to write script(s) or edit / arrange text files for every mux.
Post Reply