custom tools, allow to interpolate the parameters with the result of the input query, close #53

This commit is contained in:
Basile Burg 2016-06-19 07:46:42 +02:00
parent d2bbe29e88
commit cc4fdbfc40
1 changed files with 9 additions and 1 deletions

View File

@ -193,6 +193,7 @@ end;
procedure TCEToolItem.execute(previous: TCEToolItem);
var
arg: string;
prm: string;
inp: string;
old: string;
@ -220,7 +221,14 @@ begin
begin
prm := '';
if InputQuery('Parameters', '', prm) then
if prm.isNotEmpty then fProcess.Parameters.AddText(fSymStringExpander.expand(prm));
begin
prm := fSymStringExpander.expand(prm);
arg := StringReplace(fParameters.Text, '<$1>', prm, [rfReplaceAll]);
if prm.isNotEmpty and (arg = fParameters.Text) then
fProcess.Parameters.AddText(prm)
else
fProcess.Parameters.Text := arg;
end;
end;
ensureNoPipeIfWait(fProcess);
//