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

Re: [edit+] Question about user tools and stdin

Expand Messages
  • mljones1947
    I substituted the Windows command line sort program and got the error Input file specified two times. whenever there was more than one word being passed. I
    Message 1 of 6 , May 31, 2012
    • 0 Attachment
      I substituted the Windows command line sort program and got the error "Input file specified two times." whenever there was more than one word being passed. I confirmed with a batch file that EditPlus is passing each word as a separate argument.

      If I passed the current word, I got the word back, followed by the error "The system cannot find the file specified." EditPlus seems to be passing some trailing data even if you specify $(CurWord) even though I couldn't pick it up in the batch file (CF or LF?).

      I know this doesn't help, but I've always passed the entire file and have no first-hand experience with selection within it.

      --- In editplus@yahoogroups.com, Our Lady Guadalupe <bold_cucumber@...> wrote:
      >
      > I managed to get it working, everything identical to the way I was doing it before except using this batch file as the command:
      >
      >
      >
      > @echo off
      >
      > setlocal
      >
      > SET B="%TEMP%\%~nx1blah.tmp"
      >
      > if exist %B% del %B%
      >
      >
      >
      > for /F "tokens=*" %%a in ('more') do (
      >
      >   echo %%a >> %B%
      >
      > )
      >
      > sort %B%
      >
      >
      >
      > it grabs stdin using more, writes it to a temp file, and calls sort on the temp file.  Still not ideal though.
      >
      >
      >
      > --- On Wed, 5/30/12, bold_cucumber <bold_cucumber@...> wrote:
      >
      > From: bold_cucumber <bold_cucumber@...>
      > Subject: [edit+] Question about user tools and stdin
      > To: editplus@yahoogroups.com
      > Date: Wednesday, May 30, 2012, 9:42 AM
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >  
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > Hi all, I'm trying to use the GNU win32 version of sort (http://www.gnu.org/software/coreutils/) as a text filter to sort input from editplus. It doesn't seem to be working if I use current selection as the input, something like this:
      >
      >
      >
      > menu text: sort
      >
      > command: C:\Program Files (x86)\GnuWin32\bin\sort.exe
      >
      > argument: $(CurSel)
      >
      > action: run as text filter (replace)
      >
      >
      >
      > When I use the user tool all that happens is I see "User tool: sort" in blue at the bottom of the window, to indicate that the user tool ran, but nothing else happens.
      >
      >
      >
      > I tried setting up another user tool, with everything being identical to the above except the command running this perl script, which just removes leading and trailing spaces:
      >
      >
      >
      > #!/usr/bin/perl
      >
      > use warnings;
      >
      > use strict;
      >
      > while (my $text = <STDIN>) {
      >
      > chomp $text;
      >
      > $text =~ s/^[ \t]+|[ \t]+$//g;
      >
      > print "$text\n";
      >
      > }
      >
      >
      >
      > and that worked as expected. Should I take this to mean that the gnu sort tool isn't handling stdin properly? This works from the command line, if I have some unsorted text in a file:
      >
      >
      >
      > type blah.txt | sort
      >
      >
      >
      > Maybe is there a way to get more fancy with input redirection in dos, along the lines of "<&" in linux, that would allow this to work?
      >
      >
      >
      > On the other hand, it does work if you use $(Prompt) or $(WindowList) as the argument, I assume because editplus saves the text to a temporary location and passes that temp filename into sort. The only negative is that you have to hit ok on the dialogue that pops up when you run the user tool.
      >
      >
      >
      > Any advice would be appreciated, thanks.
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Ronnie Kiser
      I have found in the past that sometimes is necessary to use quotes on the command depending on the action used. Especially with batch files. However there
      Message 2 of 6 , May 31, 2012
      • 0 Attachment
        I have found in the past that sometimes is necessary to use "quotes" on the command depending on the action used. Especially with batch files. However there does not seem to be a rhyme nor reason to it because it can make some programs fail. I have seen this solve a program exiting silently in the bottom of the window many times. It has happened to me often when using "Action:Run Hidden". Not sure about other "Actions" but it seems worth a try.
         
        Command: "C:\Program Files (x86)\GnuWin32\bin\sort.exe"

        Also sometimes is necessary to "quote" the Argument to solve.

        Argument: "$(CurSel)"
        Argument: "$(CurWord)"

        Hope that helps.


        ________________________________
        From: mljones1947 <mljones1947@...>
        To: editplus@yahoogroups.com
        Sent: Thursday, May 31, 2012 4:27 PM
        Subject: Re: [edit+] Question about user tools and stdin


         


        I substituted the Windows command line sort program and got the error "Input file specified two times." whenever there was more than one word being passed. I confirmed with a batch file that EditPlus is passing each word as a separate argument.

        If I passed the current word, I got the word back, followed by the error "The system cannot find the file specified." EditPlus seems to be passing some trailing data even if you specify $(CurWord) even though I couldn't pick it up in the batch file (CF or LF?).

        I know this doesn't help, but I've always passed the entire file and have no first-hand experience with selection within it.

        --- In editplus@yahoogroups.com, Our Lady Guadalupe <bold_cucumber@...> wrote:
        >
        > I managed to get it working, everything identical to the way I was doing it before except using this batch file as the command:
        >
        >
        >
        > @echo off
        >
        > setlocal
        >
        > SET B="%TEMP%\%~nx1blah.tmp"
        >
        > if exist %B% del %B%
        >
        >
        >
        > for /F "tokens=*" %%a in ('more') do (
        >
        >   echo %%a >> %B%
        >
        > )
        >
        > sort %B%
        >
        >
        >
        > it grabs stdin using more, writes it to a temp file, and calls sort on the temp file.  Still not ideal though.
        >
        >
        >
        > --- On Wed, 5/30/12, bold_cucumber <bold_cucumber@...> wrote:
        >
        > From: bold_cucumber <bold_cucumber@...>
        > Subject: [edit+] Question about user tools and stdin
        > To: editplus@yahoogroups.com
        > Date: Wednesday, May 30, 2012, 9:42 AM
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >  
        >
        >
        >
        >
        >
        >
        >
        >
        >
        > Hi all, I'm trying to use the GNU win32 version of sort (http://www.gnu.org/software/coreutils/) as a text filter to sort input from editplus. It doesn't seem to be working if I use current selection as the input, something like this:
        >
        >
        >
        > menu text: sort
        >
        > command: C:\Program Files (x86)\GnuWin32\bin\sort.exe
        >
        > argument: $(CurSel)
        >
        > action: run as text filter (replace)
        >
        >
        >
        > When I use the user tool all that happens is I see "User tool: sort" in blue at the bottom of the window, to indicate that the user tool ran, but nothing else happens.
        >
        >
        >
        > I tried setting up another user tool, with everything being identical to the above except the command running this perl script, which just removes leading and trailing spaces:
        >
        >
        >
        > #!/usr/bin/perl
        >
        > use warnings;
        >
        > use strict;
        >
        > while (my $text = <STDIN>) {
        >
        > chomp $text;
        >
        > $text =~ s/^[ \t]+|[ \t]+$//g;
        >
        > print "$text\n";
        >
        > }
        >
        >
        >
        > and that worked as expected. Should I take this to mean that the gnu sort tool isn't handling stdin properly? This works from the command line, if I have some unsorted text in a file:
        >
        >
        >
        > type blah.txt | sort
        >
        >
        >
        > Maybe is there a way to get more fancy with input redirection in dos, along the lines of "<&" in linux, that would allow this to work?
        >
        >
        >
        > On the other hand, it does work if you use $(Prompt) or $(WindowList) as the argument, I assume because editplus saves the text to a temporary location and passes that temp filename into sort. The only negative is that you have to hit ok on the dialogue that pops up when you run the user tool.
        >
        >
        >
        > Any advice would be appreciated, thanks.
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        > [Non-text portions of this message have been removed]
        >




        [Non-text portions of this message have been removed]
      • RonnieKiser
        I have found in the past that sometimes is necessary to use quotes on the command depending on the action used. Especially with batch files. However there
        Message 3 of 6 , May 31, 2012
        • 0 Attachment
          I have found in the past that sometimes is necessary to use "quotes" on the command depending on the action used. Especially with batch files. However there does not seem to be a rhyme nor reason to it because it can make some programs fail. I have seen this solve a program exiting silently in the bottom of the window many times. It has happened to me often when using "Action:Run Hidden". Not sure about other "Actions" but it seems worth a try.

          Command: "C:\Program Files (x86)\GnuWin32\bin\sort.exe"

          Also sometimes is necessary to "quote" the Argument to solve.
          Argument: "$(CurSel)"
          Argument: "$(CurWord)"

          Hope that helps.

          --- In editplus@yahoogroups.com, "mljones1947" <mljones1947@...> wrote:
          >
          >
          >
          > I substituted the Windows command line sort program and got the error "Input file specified two times." whenever there was more than one word being passed. I confirmed with a batch file that EditPlus is passing each word as a separate argument.
          >
          > If I passed the current word, I got the word back, followed by the error "The system cannot find the file specified." EditPlus seems to be passing some trailing data even if you specify $(CurWord) even though I couldn't pick it up in the batch file (CF or LF?).
          >
          > I know this doesn't help, but I've always passed the entire file and have no first-hand experience with selection within it.
          >
          > --- In editplus@yahoogroups.com, Our Lady Guadalupe <bold_cucumber@> wrote:
          > >
          > > I managed to get it working, everything identical to the way I was doing it before except using this batch file as the command:
          > >
          > >
          > >
          > > @echo off
          > >
          > > setlocal
          > >
          > > SET B="%TEMP%\%~nx1blah.tmp"
          > >
          > > if exist %B% del %B%
          > >
          > >
          > >
          > > for /F "tokens=*" %%a in ('more') do (
          > >
          > >   echo %%a >> %B%
          > >
          > > )
          > >
          > > sort %B%
          > >
          > >
          > >
          > > it grabs stdin using more, writes it to a temp file, and calls sort on the temp file.  Still not ideal though.
          > >
          > >
          > >
          > > --- On Wed, 5/30/12, bold_cucumber <bold_cucumber@> wrote:
          > >
          > > From: bold_cucumber <bold_cucumber@>
          > > Subject: [edit+] Question about user tools and stdin
          > > To: editplus@yahoogroups.com
          > > Date: Wednesday, May 30, 2012, 9:42 AM
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >  
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > Hi all, I'm trying to use the GNU win32 version of sort (http://www.gnu.org/software/coreutils/) as a text filter to sort input from editplus. It doesn't seem to be working if I use current selection as the input, something like this:
          > >
          > >
          > >
          > > menu text: sort
          > >
          > > command: C:\Program Files (x86)\GnuWin32\bin\sort.exe
          > >
          > > argument: $(CurSel)
          > >
          > > action: run as text filter (replace)
          > >
          > >
          > >
          > > When I use the user tool all that happens is I see "User tool: sort" in blue at the bottom of the window, to indicate that the user tool ran, but nothing else happens.
          > >
          > >
          > >
          > > I tried setting up another user tool, with everything being identical to the above except the command running this perl script, which just removes leading and trailing spaces:
          > >
          > >
          > >
          > > #!/usr/bin/perl
          > >
          > > use warnings;
          > >
          > > use strict;
          > >
          > > while (my $text = <STDIN>) {
          > >
          > > chomp $text;
          > >
          > > $text =~ s/^[ \t]+|[ \t]+$//g;
          > >
          > > print "$text\n";
          > >
          > > }
          > >
          > >
          > >
          > > and that worked as expected. Should I take this to mean that the gnu sort tool isn't handling stdin properly? This works from the command line, if I have some unsorted text in a file:
          > >
          > >
          > >
          > > type blah.txt | sort
          > >
          > >
          > >
          > > Maybe is there a way to get more fancy with input redirection in dos, along the lines of "<&" in linux, that would allow this to work?
          > >
          > >
          > >
          > > On the other hand, it does work if you use $(Prompt) or $(WindowList) as the argument, I assume because editplus saves the text to a temporary location and passes that temp filename into sort. The only negative is that you have to hit ok on the dialogue that pops up when you run the user tool.
          > >
          > >
          > >
          > > Any advice would be appreciated, thanks.
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > [Non-text portions of this message have been removed]
          > >
          >
        • bold_cucumber
          Just tried it with quotes around the argument, still didn t work.
          Message 4 of 6 , Jun 8, 2012
          • 0 Attachment
            Just tried it with quotes around the argument, still didn't work.



            --- In editplus@yahoogroups.com, Ronnie Kiser <ronniekiser@...> wrote:
            >
            > I have found in the past that sometimes is necessary to use "quotes" on the command depending on the action used. Especially with batch files. However there does not seem to be a rhyme nor reason to it because it can make some programs fail. I have seen this solve a program exiting silently in the bottom of the window many times. It has happened to me often when using "Action:Run Hidden". Not sure about other "Actions" but it seems worth a try.
            >  
            > Command: "C:\Program Files (x86)\GnuWin32\bin\sort.exe"
            >
            > Also sometimes is necessary to "quote" the Argument to solve.
            >
            > Argument: "$(CurSel)"
            > Argument: "$(CurWord)"
            >
            > Hope that helps.
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.