A Button for translate selected file name
Moderators: white, Hacker, petermad, Stefan2
A Button for translate selected file name
Translate selected file names without extension and send to external program like Qtranslate via button would be useful.
Re: A Button for translate selected file name
And why don't you make that button for yourself ?
This is of course only possible if the program has command line parameters.
This is of course only possible if the program has command line parameters.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
TC 11.03 x64 / x86
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
Re: A Button for translate selected file name
The problem is copy file names without extension, how can I do that?
Re: A Button for translate selected file name
Use %O in stead of %N as the parameter
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: A Button for translate selected file name
From TC help > Operation > User interface > Dialog box to change the whole button bar:
Dalai
Regards%O places the current filename without extension into the command line.
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: A Button for translate selected file name
Create a button
Command: cmd /c
Parameter: ECHO %O
Startpath:
Icon: e.g. "C:\windows\system32\cmd.exe" -or- "%Commander_Path%\WCMICONS.DLL"
Tooltip: Copy name of current selected file to clipboard w/o extension
[x] Run minimized
- - -
For to pass several names without extension to a third-party programm, use a batch or a script.
Here's how to create a batch:
MakeBAT plugin by Christian Ghisler
https://www.ghisler.com/dplugins.htm
MakeBAT plugin by Christian Ghisler - a plugin to create batch files
Plugin zum Erzeugen von Batchdateien (*.bat) mit allen markierten Dateien,
Installation:
=============
1. Unzip the makebat.wcx to the Totalcmd directory
2. In Total Commander, choose Configuration - Options
3. Open the 'Packer' page
4. Click 'Configure packer extension WCXs'
5. type 'bat' as the extension (without the single quotes)
6. Click 'new type', and select the makebat.wcx
7. Click OK
Read the "install.txt"
Useful tip that is not in README:
if your string starts and ends with a quote as in
"c:\pgm files\tc\some.exe" %N "C:\docs & setngs\"
you need to double up on the first and last quotes
""c:\pgm files\tc\some.exe" %N "C:\docs & setngs\""
due to the WindowsTM API may removes outer quotes on strings on writing/reading.
Also note that some called third-party tool may interpret
the trailing __\"__ as like "escape the quote as to remove them".
Usage:
======
- Select wanted files
(here for example from TCs LANGUAGE-folder:
WCMD_DEU.MNU
WCMD_ENG.MNU
)
- Call pack dialog Alt+F5
- choose as "packer" the 'bat' from the drop-down list
- click [OK]
- In dialog box enter wanted command line, like: ECHO %O
(right click a button on TCs buttonbar, click Change...,
click [Help] to read more about variables like "%O")
- click [OK]
- Find in other panel a new textfile "<folder name>.bat"
(for our example: "LANGUAGE.BAT" with content:
ECHO WCMD_DEU
ECHO WCMD_ENG
)
Now open that text file
- adjust the command lines if need
(read the instructions of the called application what it needs as command)
- add on top as first line: @ECHO OFF
- add as last line: PAUSE
So you get:
@ECHO OFF
ECHO WCMD_DEU
ECHO WCMD_ENG
PAUSE
Now your batch is ready to be started
MakeBAT plugin by Christian Ghisler - a plugin to create batch files
Plugin zum Erzeugen von Batchdateien (*.bat) mit allen markierten Dateien,
Installation:
=============
1. Unzip the makebat.wcx to the Totalcmd directory
2. In Total Commander, choose Configuration - Options
3. Open the 'Packer' page
4. Click 'Configure packer extension WCXs'
5. type 'bat' as the extension (without the single quotes)
6. Click 'new type', and select the makebat.wcx
7. Click OK
Read the "install.txt"
Useful tip that is not in README:
if your string starts and ends with a quote as in
"c:\pgm files\tc\some.exe" %N "C:\docs & setngs\"
you need to double up on the first and last quotes
""c:\pgm files\tc\some.exe" %N "C:\docs & setngs\""
due to the WindowsTM API may removes outer quotes on strings on writing/reading.
Also note that some called third-party tool may interpret
the trailing __\"__ as like "escape the quote as to remove them".
Usage:
======
- Select wanted files
(here for example from TCs LANGUAGE-folder:
WCMD_DEU.MNU
WCMD_ENG.MNU
)
- Call pack dialog Alt+F5
- choose as "packer" the 'bat' from the drop-down list
- click [OK]
- In dialog box enter wanted command line, like: ECHO %O
(right click a button on TCs buttonbar, click Change...,
click [Help] to read more about variables like "%O")
- click [OK]
- Find in other panel a new textfile "<folder name>.bat"
(for our example: "LANGUAGE.BAT" with content:
ECHO WCMD_DEU
ECHO WCMD_ENG
)
Now open that text file
- adjust the command lines if need
(read the instructions of the called application what it needs as command)
- add on top as first line: @ECHO OFF
- add as last line: PAUSE
So you get:
@ECHO OFF
ECHO WCMD_DEU
ECHO WCMD_ENG
PAUSE
Now your batch is ready to be started
Here a VBScript to read all selected files, drop the extension and call the external application (< your part to add)
Code: Select all
'///////////////////////////////////////////////////////////////////////////////////////
'// VB-Script for Total Commander.
'// Name : _ForEachSelFileDo_CallThirdpartyprogramWithoutExtension.vbs
'// Author : Stefan, 2019-02-25, v00.1
'// Found at: https://ghisler.ch/board/viewtopic.php?p=351991#p351991
'// Purpose: Call external third-party program and pass selected file names.
'// ToDo:
'// Add your code below between the two '###-lines
'//
'// To use, create an button or user defined command (usercmd.ini)"
'// Command: "D:\rive\path to\TotalCmd\Scrips\this.vbs" or best "%Commander_Path%\Scripts\this.vbs"
'// Parameter: "%L"
'// (Use the quotes as shown too for both cmd and param!)
'// In button dialog press F1-key to read more: %L, %l, %F, %f, %D, %d, %WL, %WF, %UL, %UF
'// create a list file with the names of the selected files and directories,...
'// Startpath: <empty>
'// Icon: e.g. C:\windows\System32\WScript.exe -or- "%Commander_Path%\WCMICONS.DLL"
'// Tooltip: e.g.: _ForEachSelFileDo_ call
'///////////////////////////////////////////////////////////////////////////////////////
' THE CODE:
On Error Resume Next
ShowMessage=true
If Wscript.arguments.Count < 1 Then
MsgBox "Parameter missed. Script quits here.",,"TC script error"
WScript.Quit
Else
sTCtempList = Wscript.arguments.Item(0) ' The TC temp file due to the "%L"-parameter.
End If
Set FSO = CreateObject("Scripting.FileSystemObject")
SET WSO = CreateObject("WScript.Shell")
If FSO.FileExists(sTCtempList) Then
iFileCount = 0
Set oTextStream = FSO.OpenTextFile(sTCtempList,1)
Do Until oTextStream.AtEndOfStream
iFileCount = iFileCount + 1
sFullName = oTextStream.ReadLine '//Ex: "X:\Backup\File.txt"
If(Right(sFullName,1)= "\") Then
Set oItem = FSO.GetFolder(sFullName)
Else
Set oItem = FSO.GetFile(sFullName)
End If
sName = FSO.GetFileName(oItem)
sBase = FSO.GetBaseName(oItem)
sExte = FSO.GetExtensionName(oItem)
sDrive = FSO.GetDriveName(oItem)
sPath = oItem.ParentFolder
aPathParts = split(sPath, "\")
iUBound = UBound(aPathParts)
sParentFolder1 = aPathParts(iUBound)
If (iUBound > 0) Then sParentFolder2 = aPathParts(iUBound -1)
If (iUBound > 1) Then sParentFolder3 = aPathParts(iUBound -2)
If (iUBound > 0) Then sTopFolder1 = aPathParts(1)
If (iUBound > 1) Then sTopFolder2 = aPathParts(2)
If (iUBound > 2) Then sTopFolder3 = aPathParts(3)
'###
'//The purpose of this script (do work here):
IF(ShowMessage) Then
'MB = MsgBox(prompt[, buttons 1vbOKCancel 3vbYesNoCancel vbDefaultButton1 vbQuestion vb-Modal][, title])
MB = MsgBox("Current file: " &vbLF&""""& sFullName & vbLF _
& "Thas is: " & sBase & """ with Extension: """ & sExte &"""" _
& vbLF&vbLF&"Continue with next file?", VBYesNo+vbQuestion,"Total Commander VBScript")
If (MB = vbNo) Then WScript.Quit
End IF '(debug) Then
'WSO.Run <here the command line of your third-party program....
'WSO.Run strCommand [,intWindowStyle 0=Hide 1=Activate 2=mini 3=maxi ...] [,bWaitTillFinish? True/False]
'https://ss64.com/vb/run.html
'WSO.Run "%COMSPEC% /k xcacls """ & sParentFolder1 & """ /E /G Domain\User:F"
'WSO.Run "WMplayer ""C:\Users\Public\Videos\Sample Videos\Wildlife""",1,False
'WSO.Run str7z & " a -t7z -mx9 -r -y " & strArchive & " " & vSource, 0, True
'//copy ONE name to clipboard:
'wso.run "cmd /c ECHO " & sBase & " |clip", 0, true
'//collect ALL names for to copy to clipboard later:
strClipboardContent = strClipboardContent & sBase & vbCRLF
'###
Loop
oTextStream.Close
MsgBox strClipboardContent
SetClip strClipboardContent
MsgBox "All done"
Else
MsgBox "Input file sTCtempList not found.",,"Total Commander VBScript - ERROR"
End If
'/////////////////////////////////////////////////////////////////////////////////
Function SetClip(strText)
Set oExecCMD = WSO.Exec("clip")
Set oExecCMDIn = oExecCMD.stdIn
oExecCMDIn.WriteLine strText
oExecCMDIn.Close
End Function 'SetClip(strText)
'///////////////////////////////////////////////////////////////////////////////// THE END