Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - espkk

Pages: [1] 2
Beta Releases / Re: Multi Commander v7.6 BETA
« on: November 22, 2017, 22:56:30 »
Right... just checked in previous versions, there is the same thing
The problem appears when the menu bar is hidden in settings: if you open any menu and hover on its caption and then close the bar by pressing ALT or refreshing views.

Beta Releases / Re: Multi Commander v7.6 BETA
« on: November 22, 2017, 20:27:04 »
"Extensions" and "Tools" menus stay highlighted even unfocused  :o
Never noticed that before

Beta Releases / Re: New Already Exists Dialog
« on: November 22, 2017, 19:06:42 »
Renaming the new file is more consistent I guess... But renaming the existing file may be also useful in some cases
It's a good idea to implement both options unless they won't complicate the interface

P.S. sorry for reminding here, but can you check PM, please

Beta Releases / Re: New Already Exists Dialog
« on: November 22, 2017, 10:15:57 »
Or "keep both" might also mean that it should be copied and rename it.. so that you get both files there
That's what I meant. It's useful when you want to archive/backup files(here default backup command doesnt't quite fit), but don't care about renaming matching files to "filename_(1)" for example.

Beta Releases / Re: New Already Exists Dialog
« on: November 21, 2017, 18:02:58 »
Highlighting the timestamp of the newest file would be useful. Same for the highest size
Also, it could have "Keep both" option -- copy/move with incremental autorename

Feature Requests and Suggestions / Re: Editable path in each panel
« on: November 20, 2017, 14:08:01 »
Please make the path for each panel editable so that:
- it can be quickly added to e.g. I:\abc to I:\abc\def\xyz
- it can be easily copied (ctrl-C) for use in other applications
- it can be overwritten by pasting (ctrl-V) from other applications
1. cd def\xyz
2. alt-shift-p
3. did you try ctrl+v?

Support and Feedback / Re: Active Side every Time 75:25
« on: November 05, 2017, 17:07:36 »
If you mean split size, check Core Settings->Layout->Application layout->Panel Tab->Remember split size between restarts

Hello there
I'm using a large number of portable programs for a long time(including Multi Commander).
Some of them are console, the others are GUI, but most of them accept arguments.
Sometimes it's very handy to use MC tools for shortcuts/buttons/file type setup, but in most cases this is not enough for me, therefore, I decided to make a tiny tool which finds and executes specified filename(or even the beginning of the filename). First version was written in Batch script, it had worked pretty slow and I've rewritten it to C(the code is below).

This tool (let's call it just "run") supports executing .bat, .cmd, .exe, .vbs and any other extension located in PATHEXT global variable
It tries to find specified file recursively, starting with root to itself folder. This is especially useful with portable devices where all paths should be relative. That's how portable programs approximately organized in my PC:
Code: [Select]
X:\data\exec\!run.exe    <--- Our tool. I called it "!run" because I have another program called "run"
X:\data\exec\script1.vbs <---vbs script
X:\data\exec\script2.bat <---batch script
And so on

To execute any of them with any arguments, I only need to "!run <filename> [args]"
For example:
"!run upx -9 target.exe" - run upx\upx.exe with arguments "-9 target.exe"
"!run proc" - run sysinternals\procmon\procmon.exe
"!run multi" - run mc\multicommander.exe

Using this tool with MC is very useful because you can easily copy filepaths and pass them as arguments. (Don't forget to wrap path arguments with spaces in quotation marks, otherwise your programs will parse them as different arguments)
Keep in mind that MC command line is limited to visible borders, but I hope this will be changed in future.

Well, let's integrate our tool with Multi Commander:
1. Add new script
Code: [Select]
function GetArgs()
  @var $args = "";
  @var $n;
  @var $a;
  for( $n = 1; $n < $argcount; $n = $n + 1 )
       $a = $arg($n);
       $args += ' "' + $a + '"';
  return $args;

@var $cmd = GetTagValue("${mcinstallpath}") + "\\..\\!run.exe"; //change this line to your !run.exe path if needed!!!
@var $cmdargs = StrTrimLeft($arg(0), ":") + GetArgs();

if( StrFind($arg(0), ":", 0) == 0 )
  MC.Run CMD="{$cmd}" ARG="{$cmdargs}" ADMIN
  MC.Run CMD="{$cmd}" ARG="{$cmdargs}"
Note that script also allow you to run our tool with Admin rights by prefixing filename with ':'

2. Make alias for that script. Personally, I use just "r"

3. Use it!
Same examples using MC:
r firef - run X:\data\exec\firefox\firefox.exe
r upx -9 "C:\Program Files\Test\Test.exe" - run X:\data\exec\upx\upx.exe with arguments "-9 "C:\Program Files\Test\Test.exe""
r :procm - run X:\data\exec\sysinternals\procmon\procmon.exe with admin rights

Note that you can use it the same way everywhere - just locate !run.exe in program files for example, and modify path to !run.exe in MC scripts(or make additional script)

I hope it will be helpful for someone   ;)
And sorry for my bad English

Source code for "run" tool (compiles with any VS version):
Code: [Select]
#include <stdint.h>
#include <string.h>
#include <Windows.h>
#include <Shlwapi.h>
#pragma comment(lib, "Shlwapi")

LPWSTR *szArgList;

#define UNC_PREFIX L"\\\\?\\"
#define MAX_PATH_UNC (INT16_MAX-sizeof(UNC_PREFIX))

int ExecuteFile(const LPWSTR szPath)
wcscpy(szCurPathUNC, UNC_PREFIX);
LPWSTR szCurPath = szCurPathUNC+4;

if (szPath)
if (wcscpy_s(szCurPath, MAX_PATH_UNC, szPath))
return FALSE;
GetModuleFileNameW(GetModuleHandle(NULL), szCurPath, MAX_PATH_UNC);
*wcsrchr(szCurPath, L'\\') = L'\0';

size_t nLen = wcslen(szCurPath);
if (wcscat_s(szCurPath, MAX_PATH_UNC, szArgList[1]) ||
wcscat_s(szCurPath, MAX_PATH_UNC, L"*"))
return FALSE;

HANDLE hFind = FindFirstFileW(szCurPathUNC, &ffd);
szCurPath[nLen] = '\0';

if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
LPWSTR pExt = PathFindExtensionW(ffd.cFileName);

static WCHAR szPathExt[1024];
if (!szPathExt[0])
GetEnvironmentVariableW(L"PATHEXT", szPathExt, sizeof(szPathExt));

PWCHAR buf, pPathExt = wcstok(szPathExt, L";", &buf);
while (pPathExt != NULL)
if (_wcsicmp(pExt, pPathExt) == 0)
if (wcscat_s(szCurPath, MAX_PATH_UNC, ffd.cFileName))
return FALSE;

PWCHAR pArgs = wcschr(lpCmd, L' ');
if (pArgs != NULL)

ShellExecuteW(NULL, NULL, szCurPath, pArgs, NULL, SW_SHOW);
return TRUE;

pPathExt = wcstok(NULL, L";", &buf);
} while (FindNextFileW(hFind, &ffd) != 0);

if (wcscat_s(szCurPath, MAX_PATH_UNC, L"*"))
return FALSE;

hFind = FindFirstFileW(szCurPathUNC, &ffd);
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
if (wcscmp(ffd.cFileName, L".") != 0 && wcscmp(ffd.cFileName, L"..") != 0)
szCurPath[nLen] = '\0';
if (wcscat_s(szCurPath, MAX_PATH_UNC, ffd.cFileName))
return FALSE;

if (ExecuteFile(szCurPath))
return TRUE;
} while (FindNextFileW(hFind, &ffd) != 0);

return FALSE;

int WINAPI wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow)
int nArgCount;
szArgList = CommandLineToArgvW(GetCommandLineW(), &nArgCount);
lpCmd = lpCmdLine;

if (nArgCount == 1)
MessageBoxW(NULL, L"Usage: run <(beginning of)filename> [args]", L"Error", MB_ICONHAND);

MessageBoxW(NULL, L"File not found", L"Error", MB_ICONASTERISK);


Feature Requests and Suggestions / Re: SFX archives support
« on: June 29, 2017, 20:29:15 »
Thanks, but I've meant can I open normal archive(not SFX) file as folder(thro' FS plugin) from script and from C++ API?

Feature Requests and Suggestions / Re: SFX archives support
« on: June 29, 2017, 19:02:53 »
I thought lib decompresses buffer, not the entire file... Ok, then it's probably not a good idea, especially if you don't have the time for it
BTW, stock 7z console(which is also opensource) supports such files:
7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04

Scanning the drive for archives:
1 file, 1685398 bytes (1646 KiB)

Listing archive: t.7z

Path = t.7z
Warning: The archive is open with offset
Type = 7z
Offset = 162816
Physical Size = 1522582
Headers Size = 106
Method = LZMA2:1536k
Solid = -
Blocks = 1

P.S. Is there a way to call FS plugin manually? I mean to force them to read a file using scripts or API?

Feature Requests and Suggestions / Re: SFX archives support
« on: June 29, 2017, 18:30:28 »
Generally, SFX is a concatenation of a program to unpack it's overlay(what is right after PE in the same file) and the archive itself
So, the offset of an archive is always known from the outside. Many archivers open SFX like usual archives by skipping PE program. It's useful because you can use your archiver to unpack this file, but if you don't have proper one, you can just rename it to exe...

Feature Requests and Suggestions / Re: SFX archives support
« on: June 29, 2017, 18:12:47 »
I quite often see the files packed as SFX with 7z extension
This is because most of archivers read them, but if there is no suitable archiver, you can rename 7z to exe and unpack it as SFX
Also if the file is SFX with .exe extension, it would be handy to alt+f6 them, instead of running SFX(out of harm's way)

Feature Requests and Suggestions / Re: SFX archives support
« on: June 29, 2017, 18:02:55 »
I mean FS plugins can do this check if the file has appropriate archive ext
For example: FS-7zip can't open 7z file if it's SFX, but checking it for SFX is just a few lines of code(and ms of time)
Same with File>Unpack files...
So no need to check every .exe file

Feature Requests and Suggestions / SFX archives support
« on: June 28, 2017, 15:54:19 »
Hello, Mathias
Is it possible to make SFX archives support? 7zfm deals with such files. I guess this requires just to check file for MZ sig and if overlay exists, check it as normal archive

SDK / Re: SDK outdated
« on: August 26, 2016, 14:09:42 »
Okey, thank you, just was afraid you forgot it again :)

SDK / Re: SDK outdated
« on: August 26, 2016, 13:57:54 »
Hey, Mathias   ;)

SDK / SDK outdated
« on: August 21, 2016, 11:46:00 »
Any updates for SDK? getting
Extension "***" v1.0.0.0 is to old. It is built for Interface version Extension is NOT loaded.

Script / Re: ${focusfilepath} tag
« on: April 18, 2016, 13:05:03 »
Ok, I misunderstood the meaning of func names, it works, thanks  :)

Script / Re: ${focusfilepath} tag
« on: April 18, 2016, 12:58:22 »
I read about this function, but it is only "Get the full path to the item in focus in the source view." AFAIU. What about target view?

Script / ${focusfilepath} tag
« on: April 18, 2016, 12:11:53 »
How to get value of "${focusfilepath}"?

In this code it always returns nothing
Code: [Select]
@var $cmdargs = "powershell dir " + GetTagValue("${focusfilepath}") + "-Recurse | Unblock-File";
MC.Run CMD="powershell" arg="{$cmdargs}"

Support and Feedback / Re: Multi tags in aliases
« on: April 15, 2016, 13:39:03 »
It's enough
Didn't find it
Ty again  :)

Support and Feedback / Multi tags in aliases
« on: April 15, 2016, 13:26:53 »
Is there a way to use multi tags in aliases(/command line)? My MC located in removable drive which is assigned with random drive letter in different devices. Using scripts for each alias is undesirable:c

Script / Re: Passing arguments to MC.Run
« on: April 15, 2016, 12:05:37 »
Works perfect! Thank you
(I was afraid putting arguments in quotes would force them to be passed with quotes too, but it works as required  :) )

Script / Re: Passing arguments to MC.Run
« on: April 13, 2016, 19:12:41 »
I'm not sure what you are trying to do..  How to you run the command, What do you want the script to do ?
The script should run specified app with specified arguments throw alias
The first argument is the application name which is stored in folder with the same name
I want to pass path to file with spaces which must be a single argument in double quotes
What about
Code: [Select]
return "\"" + $args + "\"";or
Code: [Select]
@var $args = "\"" + GetArgs() + "\"";
I think this would work, but I also need to pass other arguments after (or before) filepath
So, filepath must be quoted while other arguments should pass as is
Currently, MC command line deletes all double quotes ignoring \"(turns it to \, AFAIU)

Script / Passing arguments to MC.Run
« on: April 13, 2016, 13:03:24 »
Trying to use this script:
Code: [Select]
function GetArgs()
  @var $args = "";
  @var $n;
  for( $n = 1; $n < $argcount; $n = $n + 1 )
       $args = $args + " ";
       $args = $args + $arg($n);
  return $args;
@var $s = GetTagValue("${mcinstallpath}") + "\\..\\";
$s = $s + $arg(0);
$s = $s + "\\";
$s = $s + $arg(0);
$s = $s + ".exe";
@var $args = GetArgs();
MC.Run CMD="{$s}" ARG="{$args}"
The problem is the script trims double quotemarks splitting "a complex argument" into 3 arguments:

Code: [Select]
run test "a complex argument"
argc = 4
So I can't send filepath with spaces
how to solve this problem?

Pages: [1] 2