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

Re: [Clip] Highlighting text for programs

Expand Messages
  • Wayne VanWeerthuizen
    On Thu, 1 Mar 2001 19:00:29 -0500, ... That someone gave you the wrong answer. Perl was originally designed as a text file manipulation language. It is still
    Message 1 of 14 , Mar 1 11:09 PM
    • 0 Attachment
      On Thu, 1 Mar 2001 19:00:29 -0500,
      "Ray Shapp" <rayshapp@...> wrote:

      >I got really discouraged about using NoteTab to develop Perl
      >scripts when someone on this board told me I'd need a copy of
      >Apache running on my computer to debug and run perl scripts.

      That someone gave you the wrong answer.

      Perl was originally designed as a text file manipulation language.
      It is still exceptionally good for this purpose.

      It later become popular as a language for CGI programming to
      support dynamic web pages, especially pages that need to
      communicate with database servers. When testing CGI pages,
      Apache can be helpful. Although depending on the circumstances,
      may not be necessary.

      But for other tasks, such as making changes to text files,
      ActivePerl works fine just by itself.

      Perl is a versatile language that can be used to fill wide
      variety of tasks. It is designed so that programs can be
      written quickly, in fact it is often considered one of the
      better "Rapid Application Development" languages. Perl
      is a "get the job done" sort of language, not meant for
      polished applications or for writing commercial software,
      but rather as a quick solution for handling practical tasks.

      NoteTab, with clipbook called NoteAwk, makes it even easier
      to work with Perl.

      --
      Wayne M. VanWeerthuizen
      Homepage: http://landru.myhome.net/wayne
    • Ray Shapp
      Wayne I did download NoteAwk back when I was trying to use perl as I described in my previous message but even that didn t help. Would you post a simple
      Message 2 of 14 , Mar 3 1:45 AM
      • 0 Attachment
        Wayne

        I did download NoteAwk back when I was trying to use perl as I described in
        my previous message but even that didn't help. Would you post a simple
        example that I might try to follow?

        Thank you,

        Ray Shapp
      • Don Passenger
        I have had modest luck with noteawk myself. I do have it so that it tests the syntax of a script which is a HUGE plus. I keep an window open in dos to run the
        Message 3 of 14 , Mar 3 5:54 AM
        • 0 Attachment
          I have had modest luck with noteawk myself.
          I do have it so that it tests the syntax of a script which is a HUGE plus.
          I keep an window open in dos to run the scripts though as I have not had
          consistent luck running them directly out of notetab. I get an error often.

          A lot of the pages I do are meant to render a web page on the fly. I seem
          to have better luck running a script that will modify another file or that
          sort of thing. I assume I probably need some type of self server for the
          former. Maybe therein lies the confusion?

          I also find I don't see what a clip in the noteawk library is supposed to
          do. Some of them are not intuitive to me. I know I take it as a begger,
          but a "user" read-me would help -- and if it is there I have not come across
          it.

          ---
          Don Passenger
          Personal Page: http://www.iserv.net/~dpasseng
          Court Page: http://www.iserv.net/~dpasseng/grdc
          ----- Original Message -----
          From: Ray Shapp <rayshapp@...>
          To: <ntb-clips@yahoogroups.com>
          Sent: Saturday, March 03, 2001 4:45 AM
          Subject: Re: [Clip] Highlighting text for programs


          > Wayne
          >
          > I did download NoteAwk back when I was trying to use perl as I described
          in
          > my previous message but even that didn't help. Would you post a simple
          > example that I might try to follow?
          >
          > Thank you,
          >
          > Ray Shapp
          >
          >
          >
          >
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
        • Alan C.
          Hi Ray, ... The line numbering uses two clips, one of them (the clip with the grey header) is called from the first clip. The Perl script (1st clip) appears
          Message 4 of 14 , Mar 3 1:11 PM
          • 0 Attachment
            Hi Ray,

            >Yes, I can run the line numbering perl program in the samples library, but I
            >have never been able to get any of MY perl programs to run. (To run perl, I

            The line numbering uses two clips, one of them (the clip with the grey header) is called from the first clip. The "Perl script" (1st clip) appears to me it is an actual NoteTab "Clip" while the 2nd ("PerlNumLines") looks like it is a Perl type of script language, not a NoteTab "Clip" language.

            So, it appears to me that was just one method of calling up a Perl script, demonstrated in the SampleCode library. Since it worked for you . . . then perhaps the issue surrounds the mechanics of "how do you call up a Perl script on your computer" But for list topic purpose, I share a clip in the following

            and the following is just one method of even several more methods with which to call up (execute) a perl file.

            I don't know what you need or what you are looking for. But, just to share, an experience that worked/succeeded for me (yeah!!) as follows.

            I'm a beginner on Perl. And I noticed some of the beginner Perl files are with .plx file extension, not .pl file extension. Nonetheless, they run on activestate perl.

            As follows, mainly, I have 2 items portrayed. One is a clip. The 2nd is a Perl (.plx) file. The clip, when launched, the clip activates or runs a Perl script that is opened as the current document in NoteTab.

            **Key: So, you must have a .plx file opened and currently focused in NoteTab then you run the clip.

            when used in combination, the following (clip and .plx file) calls up a simple perl file which prints to the console window, reports "Hello World" (wihout the quotes)

            In the perlstuff below, copy everything between (do not copy the quoted start and end lines) the start and end lines and save it to a file named ch1a.plx

            then, open ch1a.plx in NoteTab. then launch the clip.


            H="runPerl_CurrDoc"
            ^!IfSame ^$Getext(^**)$ .plx Skip_2
            ^!Info [L]^**^%nl% is not a .plx file. So, END
            ^!Goto Exit^!IfAppOpen "C:\WINDOWS\System32\cmd.exe" skip
            ^!cmd.exe
            ^!FocusApp "C:\WINDOWS\System32\cmd.exe"
            ^!Set %curdoc%=^**

            ^!Delay 3
            ^!Keyboard #perl ^%curdoc%# ENTER
            ;--<end of clip<<


            In the above clip, the following lines

            ^!IfAppOpen "C:\WINDOWS\System32\cmd.exe" skip
            ^!cmd.exe
            ^!FocusApp "C:\WINDOWS\System32\cmd.exe"

            might need to be

            ^!IfAppOpen "C:\winnt\System32\cmd.exe" skip
            ^!cmd.exe
            ^!FocusApp "C:\winnt\System32\cmd.exe"

            Because, essentially, you'll need the path to cmd.exe in there is what you will need. You might get by with just "cmd.exe" in those two path statements.


            Perlstuff follows.

            "perl start"
            # ch1a

            print ("Hello, world!\n");
            "perl end"

            Regards, Alan.
          • Jody
            Hi Alan, Ray and Others, ... I thought maybe with all the different Windows systems out now the following bits and pieces posted by Eric in the past may be
            Message 5 of 14 , Mar 3 7:49 PM
            • 0 Attachment
              Hi Alan, Ray and Others,

              >^!Goto Exit^!IfAppOpen "C:\WINDOWS\System32\cmd.exe" skip
              >^!cmd.exe
              >^!FocusApp "C:\WINDOWS\System32\cmd.exe"

              I thought maybe with all the different Windows systems out now
              the following bits and pieces posted by Eric in the past may be
              helpful for you on this thread. Perhaps Eric can update it for
              us. ;) In short though, Win95/98/ME use command.exe and WinNT
              (and I'm pretty sure Win2000) uses cmd.exe:

              Eric wrote:
              ^!DOS is similar to ^! except that the appropriate shell is invoked
              (command.com for Win95 and cmd.exe for WinNT) with the /c parameter.

              ^!RUN uses the old Windows function call to launch applications.
              Although it should be similar to ^!, it sometimes works better to
              launch some programs with this method.

              Somebody posted:
              > I've noticed that NTP 4.82 and the betas of 4.83 sometimes get
              > stuck when running the ^$GetOutput()$ and ^$GetDosOutput$
              > commands under Win ME. For example, the simple
              >
              > ^!GetDosOutput("set")$
              >
              > command always produces this problem (works fine in 9x and NT).

              I think I may have found an explanation for this now. It seems that
              Windows ME uses Cmd.exe to open a DOS shell rather than Command.com.
              Could you try the following to see if it works on your computer?

              ^$GetOutput("cmd.exe /c set")$

              > Unfortunately I don't have cmd.exe on my Win Me computer and I
              > have almost all Windows components installed.

              I noticed that the explanation I found about cmd.exe was misleading.
              Only NT uses that. WinME still uses command.com to open DOS
              sessions. Sorry about that.

              Oddly enough, I can't use the GetDosOutput command anymore on my
              Win95 machine with command.com commands (like Set and Dir). It used
              to work fine before and it still works on my Win98 machine.
              Obviously, something has changed on my system that affects this
              feature. There must be some settings that control how DOS sessions
              work, but I can't figure out what these are.

              ---

              I will add the following also:

              Shell
              ^!Shell CommandLine (added in v4.82)
              Launches the specified file, program, or URL through the Windows
              shell. Proposed as a replacement for the default "^!" launch
              method. Example: instead of using "^!WordPad c:\autoexec.bat",
              use "^!Shell WordPad c:\autoexec.bat"

              ShellWait

              ^!ShellWait CommandLine (added in v4.82)
              Similar to the ^!Shell command, but waits until the launched
              program is terminated before moving to the next Clip instruction.
              Unlike the ^!Wait command, you can continue editing files in
              NoteTab while the application is running. Example:
              ^!ShellWait WordPad c:\autoexec.bat

              Happy Clip'n!
              Jody

              http://www.notetab.net

              Subscribe, UnSubscribe, Options
              mailto:Ntb-Clips-Subscribe@yahoogroups.com
              mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
              http://www.egroups.com/group/ntb-clips
            • Alan C.
              Hi all, Thanks Jody for the updated info. Oops in following, a hard return must have accidentally gotten deleted ... Oops, was an even bigger booboo, clumsy
              Message 6 of 14 , Mar 3 9:13 PM
              • 0 Attachment
                Hi all,

                Thanks Jody for the updated info.

                Oops in following, a hard return must have accidentally gotten deleted

                > >^!Goto Exit^!IfAppOpen "C:\WINDOWS\System32\cmd.exe" skip
                > >^!cmd.exe
                > >^!FocusApp "C:\WINDOWS\System32\cmd.exe"

                Oops, was an even bigger booboo, clumsy fingered (on the keyboard) me, one or two lines was missing and several lines were run together. So here's the runPerl_CurrDoc clip again. 'twas wrong before, It is right (at least as it formerly had worked for me the last time that I used the clip) this time

                H="runPerl_CurrDoc"
                ^!IfSame ^$Getext(^**)$ .plx Skip_2
                ^!Info [L]^**^%nl% is not a .plx file. So, END
                ^!Goto Exit
                ^!Set %curdoc%=^**
                ^!IfAppOpen "C:\WINDOWS\System32\cmd.exe" skip
                ^!cmd.exe
                ^!FocusApp "C:\WINDOWS\System32\cmd.exe"
                ^!Delay 3
                ^!Keyboard #perl ^%curdoc%# ENTER
                ;--<end of clip<<

                (the above had worked on an NT system with not winnt as the dir but windows as the dir instead) that setup has since the HD been formatted.

                I currently do not have Perl installed on any of my systems. But as soon as I finish some other projects, that will change and I'll use the clip again in my Perl learning effort/experience.

                Alan.
              • Wayne VanWeerthuizen
                On Sat, 3 Mar 2001 04:45:27 -0500, ... I will, but I need some time to get other things done first. I have posted _many_ examples in the past (some over a year
                Message 7 of 14 , Mar 5 12:40 AM
                • 0 Attachment
                  On Sat, 3 Mar 2001 04:45:27 -0500,
                  "Ray Shapp" <rayshapp@...> wrote:

                  >Wayne
                  >
                  >I did download NoteAwk back when I was trying to use perl
                  >as I described in my previous message but even that didn't
                  >help. Would you post a simple example that I might try to
                  >follow?
                  >
                  >Thank you,
                  >
                  >Ray Shapp

                  I will, but I need some time to get other things done first.

                  I have posted _many_ examples in the past (some over a year
                  ago), before the list was moved to egroups (and then to
                  yahoogroups). I'll dig through my personal archives to see
                  what I can find and repost them.

                  I also need to release an update to NoteAwk, as a few minor
                  bugs have since been found, and some clips no longer work
                  correctly with the current version of NoteTab. I'll take
                  it of this as soon as possible.


                  --
                  Wayne M. VanWeerthuizen
                  Homepage: http://landru.myhome.net/wayne
                Your message has been successfully submitted and would be delivered to recipients shortly.