26
Support and Feedback / Re: Multi tags in aliases
« on: April 15, 2016, 13:39:03 »
It's enough
Didn't find it
Ty again
Didn't find it
Ty again
January 2024
MultiCommander v13.5 is released!
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.
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
EsperoDrakeI think this would work, but I also need to pass other arguments after (or before) filepath
What aboutCode: [Select]return "\"" + $args + "\"";
orCode: [Select]@var $args = "\"" + GetArgs() + "\"";
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:run test "a complex argument"
argc = 4So I can't send filepath with spaces
C:\mc\..\test\test.exe
a
complex
argument
MC.Run CMD="..\npp\notepad++.exe"Quotebut path with single backslashes in double quotes works well?It only work if it fails to translate a escape character.. so you have have a path that is "SomePath\newpath" it will fail since \n is a escape character.
So use single quote.
GetTagValue() are a MultiScript function and can only be called from that command type. not from CustomCommandOfc I called it in multiscript
However I do know it can be confusing because a MultiScript can also call CustomCommands. But when doing embedded CustomCommand calls from MultiScript, you can not use MultiScript functions on that line. that line is run but the custom command engine.Didn't get it You mean the whole line runs in single engine?
It seems that MC.Run base path equils ${mcinstallpath} + "\", is this always the truth?can I rely on that?
MC.Run CMD="folder/file.exe";
and this is not:@var $cmd="folder/file.exe";
MC.Run CMD=$cmd;
this also works@var $cmd="folder/file.exe";
MC.Run CMD="{$cmd}";
and this SOMETIMES works and sometimes throws an error(Out of memory error in program, reading NULL pointer in debugger):@var $cmd="folder/file.exe";
MC.Run CMD={$cmd};
Escape sequence consists of a backslash (\) followed by a letter. Each Escape sequence is regarded as a single character.but path with single backslashes in double quotes works well?
If you want an actual backslash in your constant string you need to write "\\". This will translate into "\".
function GetArgs()
{
@var $args = "";
@var $n = 0;
for( $n = 0; $n < $argcount; $n = $n + 1 )
{
if( $n > 0 )
{
$args = $args + " ";
}
$args = $args + $arg($n);
}
return $args;
}
@var $exec = GetTagValue("${sourcepath}") + GetArgs();
MC.Run CMD="{$exec}";
@var $exec = GetTagValue("${mcinstallpath}") + "\..\app\app.exe";
MC.Run CMD="{$exec}";
and this code also works:MC.Run CMD=" "..\app\app.exe";
and this is not:MC.Run CMD= GetTagValue("${mcinstallpath}") + "\..\app\app.exe";
What's the problem?