
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...
Moderators: Hacker, petermad, Stefan2, white
Applescript can't even natively do Regex without piping the string into the command prompt and using SED or Grep/Awk.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.
Or, at least, internal support to vbscript as similar (and with improved way) in the plugins ScriptContentPlugin, ScriptWFX, ....I think the best solution would be to create an object model which can be used in script languages like VBScript.
Yes! I suggested an object model several years ago here!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.
Hmm, I don't know whether this is possible at all with Delphi...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.
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
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)