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

Using scripts in clips?

Expand Messages
  • Robert Bull
    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
    Message 1 of 4 , Oct 16, 2011
    • 0 Attachment
      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.


      --
      TIA,

      Robert Bull
      mailto:barlennan@...
    • Sheri
      ... There are some old clipbooks floating around for use with AWK scripts. Have a look and see if they meet your needs. Since these clipbooks were developed
      Message 2 of 4 , Oct 16, 2011
      • 0 Attachment
        On 10/16/2011 5:10 PM, Robert Bull 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.
        >
        >

        There are some old clipbooks floating around for use with AWK scripts.
        Have a look and see if they meet your needs.

        Since these clipbooks were developed prior to NoteTab's adoption of PCRE
        as its regex engine, beware if they include any use of NoteTab's regex
        Find or Replace commands.

        <http://www.notetab.com/clipbooks/noteawk.zip>
        <http://www.gnak.de/notetab/awk_13.zip>

        Regards,
        Sheri
      • Larry Hamilton
        Yes. This is a common use. There are some examples of AWK scripts that come with NoteTab. Others have used perl, Java, and others. ~Larry ... [Non-text
        Message 3 of 4 , Oct 16, 2011
        • 0 Attachment
          Yes. This is a common use.

          There are some examples of AWK scripts that come with NoteTab.

          Others have used perl, Java, and others.

          ~Larry

          On Sun, Oct 16, 2011 at 5:10 PM, 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.
          >
          >
          > --
          > TIA,
          >
          > Robert Bull
          > mailto:barlennan@...
          >


          [Non-text portions of this message have been removed]
        • 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 4 of 4 , Oct 16, 2011
          • 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.