Loading ...
Sorry, an error occurred while loading the content.

557Re: [NTS] Redirecting GAWK Output

Expand Messages
  • flo.gehrke
    May 14, 2012
      --- In ntb-scripts@yahoogroups.com, "mycroftj" <mycroftj@...> wrote:
      > --- In ntb-scripts@yahoogroups.com, "flo.gehrke" <flo.gehrke@> wrote:
      > >
      > ---snip
      > >
      > > ;[path to exe]
      > > ^!Set %lua%=
      > > ;[path to the script]
      > > ^!Set %script%=
      > > ;[text to process, e.g. ^$GetSelection$, ^$GetClipboard$]
      > > ^!Set %input%=
      > > ^!InsertText ^$GetOutput(^%lua% "^%script%" "^%input%")$
      > >
      > > I tried to reproduce this with GAWK but I can't get it to work.
      > > For me, GAWK doesn't seem to accept the input from that ^%input%
      > > variable.
      > >
      > > It works when getting the input from a file:
      > >
      > > ^!Info ^$GetOutput(^$GetGawkExe$ -f ^$GetScriptPath$script.awk ^$GetDocumentPath$input.txt)$
      > ---snip
      > > Regards,
      > > Flo
      > >
      > Did you ever get an answer to this part of this problem???
      > I think the problem here is the missing '-f' in the InsertText statement. Looks like it should be
      > ^!InsertText ^$GetOutput(^%lua% -f "^%script%" "^%input%")$
      > Joy


      diodeom described a working solution with Lua. IMHO, we can't speak of a "missing '-f' in the InsertText statement": In diodeom's model, the input doesn't come from a file but is assigned to an %Input% variable (with ^$GetSelection$ or ^$GetClipboard$).

      The problem is that we cannot apply this model to GAWK (called with NT) because we cannot use a variable as an argument in ^$GetOutput$ in a way like...

      ^$GetOutput(^$GetGawkExe$ -f ^$GetScriptPath$script.awk ^%Input%)$

      -- unless anyone explains how to achieve that.

      I hope we'll get some replies to all your questions in message #555.

      In my latest message, I described how to redirect the GAWK output TO the clipboard. So, for your own studies, it might interest you that there's also a way to get the input FROM the clipboard. See...


      If we could get this to work in a NT clip then it should be even possible to adjust diodeom's model to GAWK/NT.

    • Show all 16 messages in this topic