Page 1 of 1
Lua wdx,wfx (like double commander)
Posted: 2011-07-08, 06:14 UTC
by nsp
I've done a try to double commander
(dev version) 
and i've seen that you can create wdx plugin using lua language.
for quick stuff it could be great to have such scripting capability directly embedded.
2Ghisler as the next version is compiled with lazarus/freepascal you can even give a look at what is done in double commander...
Posted: 2011-07-09, 18:22 UTC
by Balderstrom
I don't know LUA, but I have heard very positive things about it. I know Civilization-V uses it instead of Python this time around. Although I'm boycotting CIV until at least CIV-6 -- hopefully it wont suck

Posted: 2011-07-13, 08:57 UTC
by m^2
Interesting that there's so little reaction to this suggestion. Personally I find scripting to be one of the bigger features TC lacks.
Posted: 2011-07-14, 13:24 UTC
by ghisler(Author)
Currently it's not planned to put internal scripting in Total Commander. Why? Windows is a multi-tasking system, and many tasks may involve multiple programs. Therefore it's better to use a system-wide scripting tool like AutoHotkey instead of a separate one in each program.
Posted: 2011-07-14, 13:49 UTC
by Lefteous
2ghisler(Author)
I think the best solution would be to create an object model which can be used in script languages like VBScript. Look at SpeedCommander for instance.
Posted: 2011-07-14, 18:40 UTC
by m^2
Lefteous wrote:2ghisler(Author)
I think the best solution would be to create an object model which can be used in script languages like VBScript. Look at SpeedCommander for instance.
You mean COM?
Posted: 2011-07-14, 19:45 UTC
by Lefteous
Well if there would be AppleScript or Automator on Windows I would prefer this

Have you ever worked with AppleScript?
Posted: 2011-07-14, 22:10 UTC
by Balderstrom
I have,
Example Applescript:
Please Mr.Jobs print this variable when you can get around to it from the Opera application using quoteformat unless there are no quotes then fail.
Applescript can't even natively do Regex without piping the string into the command prompt and using SED or Grep/Awk.
Posted: 2011-11-02, 09:55 UTC
by HBB
I support Lefteous' suggestion :
I think the best solution would be to create an object model which can be used in script languages like VBScript.
Or, at least, internal support to vbscript as similar (and with improved way) in the plugins ScriptContentPlugin, ScriptWFX, ....
I see that writing a plugin requires to know delphi, C++ or any other programming languages. To learn them needs time and interest.
I believe that there should be some simple ways for daily needs of average users (like me).
Regards
Posted: 2011-11-02, 17:38 UTC
by JohnFredC
Lefteous wrote:I think the best solution would be to create an object model which can be used in script languages like VBScript. Look at SpeedCommander for instance.
Yes! I suggested an object model several years ago
here!
No need for a scripting engine inside TC itself, just an interface to a defined model + methods and perhaps some dedicated hooks in the interface to start an editor, list scripts, run a script, etc.
The latest version of Salamander has exactly this schema (look under Plugins->Automation). Very useful.
Posted: 2011-11-04, 14:32 UTC
by ghisler(Author)
No need for a scripting engine inside TC itself, just an interface to a defined model + methods and perhaps some dedicated hooks in the interface to start an editor, list scripts, run a script, etc.
Hmm, I don't know whether this is possible at all with Delphi...
Posted: 2011-11-12, 19:42 UTC
by Harding
For the ones interested, I have used Total Commander with Python for some nice scripting.
Example: I made a small script that use 7-zip to "decompress here" function.
Howto:
1. Install Python.
2. Install 7-zip
3. Edit your usercmd.ini and add:
Code: Select all
[em_zip_compress_here]
cmd=C:\Python26\python.exe
button=C:\Python26\python.exe
param=c:\Python26\zip_operation_here.py compress %L
[em_zip_decompress_here]
cmd=C:\Python26\python.exe
button=C:\Python26\python.exe
param=c:\Python26\zip_operation_here.py decompress %L
4. Create your c:\Python26\zip_operation_here.py with the following code:
Code: Select all
# Written by Harding 2011-11-13 version 1.1
import sys
import time
import string
import os.path
import subprocess
import datetime
path_to_7z = "\"c:\\Program Files (x86)\\7-Zip\\7z.exe\""
ext_to_use = "zip" # can also be "7z"
def compress_7z(arg_src_files, arg_dst_dir):
src_files_string = ""
for file in arg_src_files:
src_files_string = src_files_string + " \"" + file.strip() + "\""
command = path_to_7z + " a \"" + arg_dst_dir + "\" " + src_files_string
subprocess.Popen(command)
def decompress_7z(arg_src_files, arg_dst_dir):
for compressed_file in arg_src_files:
command = path_to_7z + " x -o\"" + arg_dst_dir + "\\" + os.path.basename(compressed_file) + ".dir\" \"" + compressed_file + "\" "
subprocess.Popen(command).wait()
# If it was only 1 folder that we unpacked then move it up one step
files_unpacked = os.listdir(arg_dst_dir + "\\" + os.path.basename(compressed_file) + ".dir")
if (len(files_unpacked) == 1 and os.path.isdir(arg_dst_dir + "\\" + os.path.basename(compressed_file) + ".dir\\" + files_unpacked[0])):
command = "mv \"" + arg_dst_dir + "\\" + os.path.basename(compressed_file) + ".dir\\" + files_unpacked[0] + "\" \"" + arg_dst_dir + "\""
subprocess.Popen(command).wait()
# Delete the folder we generated
command = "rmdir \"" + arg_dst_dir + "\\" + os.path.basename(compressed_file) + ".dir\""
subprocess.Popen(command).wait()
if __name__ == '__main__':
if (len(sys.argv) < 3):
print "Invalid nubmer of args"
exit()
if ("compress" == sys.argv[1] or "decompress" == sys.argv[1]):
with open(sys.argv[2], "rb") as f:
all_marked_files = f.readlines()
all_marked_files = [x.strip() for x in all_marked_files]
dt = datetime.datetime.now()
dt = datetime.datetime.timetuple(dt)
full_path = all_marked_files[0].strip().split("\\")
full_path = [x for x in full_path if x]
dst_dir = full_path[0]
for i in range(1, len(full_path)-1):
dst_dir = dst_dir + "\\" + full_path[i]
if ("compress" == sys.argv[1]):
compress_7z(all_marked_files, dst_dir + r"\0000_" + time.strftime("%Y-%m-%d_%H_%M_%S", dt) + "_" + os.path.basename(all_marked_files[0]).strip() + "." + ext_to_use)
else:
decompress_7z(all_marked_files, dst_dir)
else:
print "Unknown command. Only \"compress\" and \"decompress\" are supported"
# time.sleep(10)
Not perfect code but you get the idea.
5. Set your hotkey under configuration -> options -> Misc. -> Command -> usercmd.ini -> em_zip_compress_here
EDIT: Added the funcionallity to create a folder for each archive and if it was only a folder in the archive then move it up one step.