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

Re: Using scripts in clips?

Expand Messages
  • diodeom
    ... I d consider ^$GetOutput()$ to pass args/variables and get back the results. (For really large blocks of text to process you could just submit the path of
    Message 1 of 4 , Oct 16, 2011
    View Source
    • 0 Attachment
      Robert Bull <barlennan@...> wrote:
      >
      > I have a few clips, and the odd AWK script which works on all the
      > (marked?) text in a file. They seem to be two separate ideas.
      >
      > Is it possible to use scripts *inside clips*? What I wondered was
      > whether one could use NTP's native clip functions to, say, retrieve
      > the contents of the clipboard, feed that text through an AWK script,
      > and have NTP pick up the result and insert it into the current file.
      >

      I'd consider ^$GetOutput()$ to pass args/variables and get back the results. (For really large blocks of text to process you could just submit the path of the file to open by your AWK script.)

      Here's a purposely overdrawn illustration of one of the ways I utilize for communication between Clip and Lua:

      ;[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")$
    Your message has been successfully submitted and would be delivered to recipients shortly.