From cc4fdbfc40602127ddd5feb34d815822b4e279f9 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 19 Jun 2016 07:46:42 +0200 Subject: [PATCH] custom tools, allow to interpolate the parameters with the result of the input query, close #53 --- src/ce_tools.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ce_tools.pas b/src/ce_tools.pas index ecf4379e..dc47a2d6 100644 --- a/src/ce_tools.pas +++ b/src/ce_tools.pas @@ -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); //