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

Re: [Clip] Re: [NTB] Using a New Compiler

Expand Messages
  • Alan
    ... I m unaware of any option to turn on in the NoteTabs settings/options. I don t think there is one. (NoteTab clips are your handy (and rather powerful)
    Message 1 of 2 , May 24, 2004
    • 0 Attachment
      Larry Thomas wrote:
      > At 07:22 AM 5/24/04 -0400, you wrote:
      >
      >>Hi,
      >>How do I make Notetab run a compiler that is not Perl or Gawk? I have one

      I'm unaware of any option to turn on in the NoteTabs settings/options.
      I don't think there is one. (NoteTab "clips" are your handy (and rather
      powerful) "tool" with which to personalize/customize NoteTab).

      Perl and Gawk do text manipulation. Thus, they can operate on/modify
      the current doc. Perl can also do many many many many other things ie
      it can run (far) outside of the limit of text manipulation.

      ^!Runperl (this NoteTab clip command) is strictly for use of Perl to
      accomplish text manipulations on the current NoteTab doc.

      current doc, however, can also (a 2nd possible use of Perl) be a Perl
      script that is to be executed (as opposed to having Perl perform text
      manipulations on the current doc).

      If you provide more specifics of what you seek to do then we can help
      you better.

      But it sounds like you have a current document that is source code that
      you want to send it to YourCompiler.exe which would have result of
      compile said source.

      In the next included 2 clips, the ^$GetPerlExe$ is a NoteTab clip
      "function" all it does is it merely finds perl.exe if it exists then
      returns the path to the same perl.exe

      so, if you substitute MyCompiler.exe so as for with it to replace
      ^$GetPerlExe$ then what you do is you run your compiler (look at comment
      line in clips).

      1st clip takes current doc source code to and runs (the compiler, be it
      Perl or Other) and then captures the output into a new NoteTab document.
      2nd clip does all of what 1st clip does except it does not capture
      output. Each line of a clip is a command (notice comment in 2nd clip
      itself of "commands to try" you must eliminate all but one since it is
      only one command (one of the lines) that will trigger off your needed
      action). Those are all very similar to each other commands but I
      included all because sometimes the need to experiment just a little
      until "dialed in" (until it works).

      2 clips follow

      ; focused doc is a perl script - use 2 run & capture the output
      :run_cur_pl_doc
      ^!Set %myfile%=^**
      ^!Set %myfile%=^$GetShort("^%myfile%")$
      ; replace ^$GetPerlExe$ with MyCompiler
      ^!Append %cmnd%=^$GetPerlExe$ ^%myfile%
      ; ^!ChDir ^%myfile%
      ^!Toolbar New Document
      ^!InsertText ^$GetDosOutput("^%cmnd%")$
      ^!ClearVariable %cmnd%
      ; ----end

      the above clip runs thens captures the output in a doc

      the next clip just runs


      ^!Set %myfile%=^**
      ^!Set %myfile%=^$GetShort("^%myfile%")$
      ; replace ^$GetPerlExe$ with MyCompiler
      ^!Append %cmnd%=^$GetPerlExe$ ^%myfile%
      ; ^!ChDir ^%myfile%
      ;---begin commands to try
      ^!Shell "^%cmnd%"
      ^!Dos "^%cmnd%"
      ^%cmnd%
      ^!"^%cmnd%"
      ^!^%cmnd%
      ;---end of commands to try
      ^!ClearVariable %cmnd%
      ; ----end


      http://groups.yahoo.com/group/ntb-scripts/messagesearch?query=runscript

      (runscript query) of archives of ntb-scripts list turns up near 9 hits
      of VERY useful info *IF you are to perform text manipulations using your
      .exe to modify your current document.

      Alan.

      >>that I want to use for another language.
      >>
      >>Thanks.
      >>
      >>Jim
      >
      >
      > Hi Jim,
      >
      > You can use the ^!Shell command to run your compiler assuming that it runs
      > from a command line and accepts parameters.
      >
      > ^!Shell Compiler.exe
      >
      > would run your compiler from NoteTab. You would of coarse need to use the
      > actual name of the program and if it does not work with the name alone,
      > then you will have to use the full path and name.
      >
      > ^!Shell "C:\Program Files\Compiler\Compiler.exe"
      >
      > You would follow the program path\name with the parameters you want to run.
      > For example, if you had the source code in an open document that is in
      > focus in NoteTab, you would use:
      >
      > ^!Shell "C:\Program Files\Compiler\Compiler.exe" /c/d/p ^$GetText$
      >
      > The program path\name is enclosed in double quotes to include the spaces.
      > The /c/d/p switches are made up. You would use your own switches for your
      > compiler that apply. And finally ^$GetText$ would return all of the text
      > from the currently focused document to the compiler for processing. You
      > would also have to specify your output file in the parameter as well which
      > is not shown above.
      >
      > There is a better way and I have never used it but the command below:
      >
      > ^!RunScript "Command" "ScripName"
      > Similar to ^!RunGawk except you must specify the command to execute the
      > console application. The stderr stream is saved in file called
      > "StdError.err" in NoteTab's application directory unless another file is
      > specified with the SetStdErrorName command. Use the code "^1" to indicate
      > where the Script file name should be inserted
      >
      > Can be used. You would probably use it in the form:
      >
      > ^!RunScript "Compiler.exe" "ScripName"
      >
      > I believe that you should probably also join:
      >
      > The NoteTab Scripts List.......... ntb-Scripts-Subscribe@yahoogroups.com
      >
      > There are probably a lot of people there who are better qualified than I to
      > help you.
    Your message has been successfully submitted and would be delivered to recipients shortly.