Selection order
Moderators: Hacker, petermad, Stefan2, white
Look,
your 'select' button should receive %P%N and: 1) add filename to end of cache, 2) mark file in TC,
your 'process' button should receive %L and: 1) count number N of files in %L, 2) take last N items from cache for processing.
So it will always process only latest selected files.
And you will only need to focus C.pdf, press shortcut, focus B.pdf, press shortcut, focus D.pdf, press shortcut and focus A.pdf and press shortcut and then execute processing.
As an option, you can open last list in e.g. in text editor before processing so you will always see what exactly will be processed, and even change order by swapping lines (there should be one filename per line, it is easy then to build single command line from such list).
You know, you have quite specific task, I don't remember any other such request for years, so your task seems to be the only requiring selection order...
your 'select' button should receive %P%N and: 1) add filename to end of cache, 2) mark file in TC,
your 'process' button should receive %L and: 1) count number N of files in %L, 2) take last N items from cache for processing.
So it will always process only latest selected files.
And you will only need to focus C.pdf, press shortcut, focus B.pdf, press shortcut, focus D.pdf, press shortcut and focus A.pdf and press shortcut and then execute processing.
As an option, you can open last list in e.g. in text editor before processing so you will always see what exactly will be processed, and even change order by swapping lines (there should be one filename per line, it is easy then to build single command line from such list).
You know, you have quite specific task, I don't remember any other such request for years, so your task seems to be the only requiring selection order...
I see now. It is possible with %P%N. When selection is restarted, since %L comes with 1, no item is considered in the cache. Good idea.
Actually, upto now, there is no support for the custom file order for the %P%S by forum friends. You seems right...
Another good idea.As an option, you can open last list in e.g. in text editor before processing so you will always see what exactly will be processed, and even change order by swapping lines (there should be one filename per line, it is easy then to build single command line from such list).
It is interesting. Most of the editors, joiners, players, .. etc. support the file order. This should not be a specific task...You know, you have quite specific task, I don't remember any other such request for years, so your task seems to be the only requiring selection order...
Actually, upto now, there is no support for the custom file order for the %P%S by forum friends. You seems right...
MVV,
I looked at the TCFS2, it seems wonderfull (like sudo and sudo64). But it is a little bit complicated (like a new programming language). However, it is possible to read, understand and use.
Until to understand fully it, can you give an example in order to focus to cmd line and in order to send the script full path. What should "hwnd" be?
I looked at the TCFS2, it seems wonderfull (like sudo and sudo64). But it is a little bit complicated (like a new programming language). However, it is possible to read, understand and use.
Until to understand fully it, can you give an example in order to focus to cmd line and in order to send the script full path. What should "hwnd" be?
I may have missed something, but hasn't white already given the hint for a very nice and easy solution?
2) Ctrl-M (multi-rename tool), no actual renaming but add full path: file name="[=tc.path][N]", extension="[E]", Search for RegEx "^(.).\", Replace by "$1:\" (fixes drive prefix, make sure you have "RegEx" checked)
3) change order as desired by dragging lines in the list. For this example: drag C.pdf to top, then A.pdf to bottom.
4) now click the little button to the right of the "Upper/lowercase" dropdown and below the other little button with "?" on it
5) Select "Configure editor..." and specify the "execute" script. For example C:\test.bat with the following contents:
6) click button from 4) again and this time select "Edit names..." - voilà 
Contrary to the "focus & Shift+Ctrl+Enter" proposal, this has the advantage of a clear (and readable) visual representation of the actual order of files, which I think is way better than having it implicit (as by having TC "remember" which was selected when).
It's also easy as pie to adjust the order in case you make a mistake. You don't have to start all over.
The script receives the path to a temporary file with the list in it as 1st parameter, so there's no need to "clear the cache".
You may of course save these settings for re-use (F2).
However, this does not include the "editor" (step 5)). To revert to normal notepad, "Configure Editor..."="c:\windows\notepad.exe".
So here's how I'd dowhite wrote:Do you know that in the multi-rename tool you can sort the list, drag around lines in the list and even delete lines from the list?
1) Select all four, A.pdf, B.pdf, C.pdf, D.pdf (order doesn't matter yet, could also come from Find files)HBB wrote:Assume 4 files will be processed: 1) A.pdf 2) B.pdf 3) C.pdf 4) D.pdf
Desired order: 1) C.pdf 2) B.pdf 3) D.pdf 4) A.pdf
2) Ctrl-M (multi-rename tool), no actual renaming but add full path: file name="[=tc.path][N]", extension="[E]", Search for RegEx "^(.).\", Replace by "$1:\" (fixes drive prefix, make sure you have "RegEx" checked)
3) change order as desired by dragging lines in the list. For this example: drag C.pdf to top, then A.pdf to bottom.
4) now click the little button to the right of the "Upper/lowercase" dropdown and below the other little button with "?" on it
5) Select "Configure editor..." and specify the "execute" script. For example C:\test.bat with the following contents:
Code: Select all
@type %1
pause

Contrary to the "focus & Shift+Ctrl+Enter" proposal, this has the advantage of a clear (and readable) visual representation of the actual order of files, which I think is way better than having it implicit (as by having TC "remember" which was selected when).
It's also easy as pie to adjust the order in case you make a mistake. You don't have to start all over.
The script receives the path to a temporary file with the list in it as 1st parameter, so there's no need to "clear the cache".
You may of course save these settings for re-use (F2).
However, this does not include the "editor" (step 5)). To revert to normal notepad, "Configure Editor..."="c:\windows\notepad.exe".
Last edited by meisl on 2014-02-21, 20:14 UTC, edited 1 time in total.
HBB,
You don't need TCFS2 with my select/process actions. You may only need TCFS2 /ef "send(`{INS}`)" in order to mark focused file with Insert. However TC must be active for this command to work (it generates keyboard input events that may only be received by active window).
However if you want to build command in TC command line, it is much faster to send Ctrl+Shift+Enter using TCFS2 /ef "send(`^+{ENTER}`)" in order to append focused file to command. This command may be added as buttonbar button or em-command with another shortcut.
Anyway, hwnd is an optional parameter for TC dialog windows, you may omit it.
meisl,
It is quite uncomfortable to switch MRT editor every time when you need to perform this specific task...
You don't need TCFS2 with my select/process actions. You may only need TCFS2 /ef "send(`{INS}`)" in order to mark focused file with Insert. However TC must be active for this command to work (it generates keyboard input events that may only be received by active window).
However if you want to build command in TC command line, it is much faster to send Ctrl+Shift+Enter using TCFS2 /ef "send(`^+{ENTER}`)" in order to append focused file to command. This command may be added as buttonbar button or em-command with another shortcut.
Anyway, hwnd is an optional parameter for TC dialog windows, you may omit it.
meisl,
It is quite uncomfortable to switch MRT editor every time when you need to perform this specific task...
MVV, thanks
TCFS2 /ef "send(`{RIGHT}Path\To\Script.exe`)" works successfully.
EDIT> with a small problem. the letter i and slashes are converted to other characters??
EDIT2> quotations surrounding script path are eaten. Is there a way to send characters as it is?
EDIT3> I found it : '~' character.
EDIT4> TCFS2 /ef "send(`{RIGHT}{DQ}Path~\To~\Scr~ipt.exe{DQ} `)" now works successfully.
TCFS2 /ef "send(`{RIGHT}Path\To\Script.exe`)" works successfully.
EDIT> with a small problem. the letter i and slashes are converted to other characters??
EDIT2> quotations surrounding script path are eaten. Is there a way to send characters as it is?
EDIT3> I found it : '~' character.
EDIT4> TCFS2 /ef "send(`{RIGHT}{DQ}Path~\To~\Scr~ipt.exe{DQ} `)" now works successfully.
HBB,
The problem of keyboard events is that they are layout and capslock-dependent (so will type e.g. Russian characters in RU layout). That's why ~ was added for sending exact Unicode characters instead, and you can use it with round brackets in following way:
The problem of keyboard events is that they are layout and capslock-dependent (so will type e.g. Russian characters in RU layout). That's why ~ was added for sending exact Unicode characters instead, and you can use it with round brackets in following way:
Code: Select all
TCFS2 /ef "send(`{RIGHT}{DQ}~(X:\Path\To\Script.exe){DQ} `)"
HBB, have you tried my approach?
Plz note that it's NOT about actual renaming, it just uses the MRT for
a) comfortably putting a list of files into some arbitrary order and then
b) passing that list to some program for further processing.
...which, as such, is in principle and IMHO a far better paradigm than what you're trying to do by "recording actions of selection", in some way or another.
You have pointed out yourself the drawbacks of that approach (-> "cache", when to reset it, etc ...).
Plz note that it's NOT about actual renaming, it just uses the MRT for
a) comfortably putting a list of files into some arbitrary order and then
b) passing that list to some program for further processing.
...which, as such, is in principle and IMHO a far better paradigm than what you're trying to do by "recording actions of selection", in some way or another.
You have pointed out yourself the drawbacks of that approach (-> "cache", when to reset it, etc ...).
HBB,
you've probably clicked the "Start!" button, judging from the error message.
Again: do NOT click the "Start!" button - it's NOT about doing an actual renaming!
(the button I'm referring to in pt 4) has a folder-like symbol on it; it is the only button in the MRT dialog with an image on it rather than a letter or phrase)
My description is admittedly rather long and detailed, but you need to actually try it up to the end in order to get a feeling of how usable it really is.
To be clear: I, myself, did actually try both of course, mine and the "repeated focus + Shift-Ctrl-Enter".
Could you explain why exactly you don't agree on that
I mean for example in terms of the number of
- keystrokes/mouse clicks,
- additional intermediate scripts/APIs to use
- additional intermediate files like .ion and/or .bbs to use (obviously: less is better, as with the 2 previous pts),
- ways to populate the list in the first place (here: more = better)
- and having an actually readable/usable visual feedback of what order your list is currently in.
(note that you can even remove single files from the list easily, as white had pointed out before as well)
you've probably clicked the "Start!" button, judging from the error message.
Again: do NOT click the "Start!" button - it's NOT about doing an actual renaming!
(the button I'm referring to in pt 4) has a folder-like symbol on it; it is the only button in the MRT dialog with an image on it rather than a letter or phrase)
Ooops...? In fact it does look by far easier and also more intuitive and straight-forward - at least to me...HBB wrote:However, this method may work, but is not easy than the others.
My description is admittedly rather long and detailed, but you need to actually try it up to the end in order to get a feeling of how usable it really is.
To be clear: I, myself, did actually try both of course, mine and the "repeated focus + Shift-Ctrl-Enter".
Could you explain why exactly you don't agree on that

I mean for example in terms of the number of
- keystrokes/mouse clicks,
- additional intermediate scripts/APIs to use
- additional intermediate files like .ion and/or .bbs to use (obviously: less is better, as with the 2 previous pts),
- ways to populate the list in the first place (here: more = better)
- and having an actually readable/usable visual feedback of what order your list is currently in.
(note that you can even remove single files from the list easily, as white had pointed out before as well)
As a result, two methods seem easy/regular to me:
Method 1 : This method is suggested by HolgerK (with MVV's improvements):
> Run command : TCFS2 /ef "send(`{RIGHT}{DQ}~(X:\Path\To\Script.exe){DQ} `)"
> Select 1. file by Control+Shift+Enter
> Select 2. file by Control+Shift+Enter
> :
> To execute, just press Enter
Method 2 : This method is suggested by MVV (with my improvements):
> Select 1. file, then press the button which runs the below script.
> Select 2. file, then press the button which runs the below script.
> :
> To execute, just press the same button again without selecting a new file (or removing a selected one)
[EDIT] Parameters of the button : %P%S (Sorry, I forgot to mention)
Script :
Set FSO=WScript.CreateObject("Scripting.FileSystemObject")
Set CacheFileObject=CreateObject("Scripting.Dictionary")
CacheFilePath=FSO.GetSpecialFolder(2).Path+"\OrderedFileListToSendToAScriptInTotalCmd.txt"
If FSO.FileExists(CacheFilePath) Then
With FSO.OpenTextFile(CacheFilePath)
Do While .AtEndOfStream <> True
FilePath=Trim(.ReadLine)
If FilePath <> "" Then CacheFileObject.Add LCase(FilePath),""
Loop
End With
End If
For Index=0 To WScript.Arguments.Count-1
FilePath=Trim(WScript.Arguments(Index))
If CacheFileObject.Exists(LCase(FilePath)) Then
CacheFileObject(LCase(FilePath))=FilePath
Else
CacheFileObject.Add LCase(FilePath),FilePath
Changed=True
End If
Next
Keys=CacheFileObject.Keys
For Index=0 To Ubound(Keys): Key=Keys(Index)
If CacheFileObject(Key) = "" Then
CacheFileObject.Remove Key
Changed=True
End If
Next
Files=CacheFileObject.Items
For Index=LBound(Files) To UBound(Files)
CachFileContent=CachFileContent+Files(Index)+vbCrLf
Count=Count+1
Next
If Changed Then
FSO.OpenTextFile(CacheFilePath,2,True).Write CachFileContent
Else
If Count=1 Then WScript.Quit
RetVal=MsgBox(CachFileContent)
' Execution is here
If FSO.FileExists(CacheFilePath) Then FSO.DeleteFile CacheFilePath, True
End If
Method 1 : This method is suggested by HolgerK (with MVV's improvements):
> Run command : TCFS2 /ef "send(`{RIGHT}{DQ}~(X:\Path\To\Script.exe){DQ} `)"
> Select 1. file by Control+Shift+Enter
> Select 2. file by Control+Shift+Enter
> :
> To execute, just press Enter
Method 2 : This method is suggested by MVV (with my improvements):
> Select 1. file, then press the button which runs the below script.
> Select 2. file, then press the button which runs the below script.
> :
> To execute, just press the same button again without selecting a new file (or removing a selected one)
[EDIT] Parameters of the button : %P%S (Sorry, I forgot to mention)
Script :
Set FSO=WScript.CreateObject("Scripting.FileSystemObject")
Set CacheFileObject=CreateObject("Scripting.Dictionary")
CacheFilePath=FSO.GetSpecialFolder(2).Path+"\OrderedFileListToSendToAScriptInTotalCmd.txt"
If FSO.FileExists(CacheFilePath) Then
With FSO.OpenTextFile(CacheFilePath)
Do While .AtEndOfStream <> True
FilePath=Trim(.ReadLine)
If FilePath <> "" Then CacheFileObject.Add LCase(FilePath),""
Loop
End With
End If
For Index=0 To WScript.Arguments.Count-1
FilePath=Trim(WScript.Arguments(Index))
If CacheFileObject.Exists(LCase(FilePath)) Then
CacheFileObject(LCase(FilePath))=FilePath
Else
CacheFileObject.Add LCase(FilePath),FilePath
Changed=True
End If
Next
Keys=CacheFileObject.Keys
For Index=0 To Ubound(Keys): Key=Keys(Index)
If CacheFileObject(Key) = "" Then
CacheFileObject.Remove Key
Changed=True
End If
Next
Files=CacheFileObject.Items
For Index=LBound(Files) To UBound(Files)
CachFileContent=CachFileContent+Files(Index)+vbCrLf
Count=Count+1
Next
If Changed Then
FSO.OpenTextFile(CacheFilePath,2,True).Write CachFileContent
Else
If Count=1 Then WScript.Quit
RetVal=MsgBox(CachFileContent)
' Execution is here
If FSO.FileExists(CacheFilePath) Then FSO.DeleteFile CacheFilePath, True
End If
Currently, there is a problem while using %S. TC assumes that the file under the cursor is selected even if it is not selected (I mean highlighted). This may not be problem for a file joiner script like above one (requires at least two files). But, it creates problem for other scripts/programs which need the highlighted files.
I searched the forum, I found a few discussion on it (There are some suggestions like %H to skip it). Is there a way to distinguish it in parameters (I asked because I sometimes miss somethings)?
I searched the forum, I found a few discussion on it (There are some suggestions like %H to skip it). Is there a way to distinguish it in parameters (I asked because I sometimes miss somethings)?