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

Re: [NTS] Any script language can work with Notetab?

Expand Messages
  • jacobhu
    ... I use ... Is it ... ================================================================ Piotr: Thanks, but it is not work. Clip lang is a strange animal???
    Message 1 of 6 , Jul 17 5:07 AM
      --- In ntb-scripts@yahoogroups.com, "Piotr Bienkowski" <syntax@n...>
      wrote:
      > W dniu 16 Jul 2004 o godzinie 14:06, jacobhu napisal(a):
      >
      > > Hi there:
      > >
      > > I am thinking in this way:
      > > Since we can get a copy of current editing file in disk, why can
      I use
      > > any script or language to control the current file? I am thinking
      > > using turbo pascal 7, winTP1.5, Free TP, Qbasic, vbscript,
      > > jscript...to edit the backup file then save it as current file.
      Is it
      > > possible? Is anyone try this before?
      > >
      >
      > Hi Jacob,
      >
      > I think you can use the ^!RunScript command command to achieve
      > it.
      >
      > HTH
      >
      > Piotr



      '================================================================
      Piotr:

      Thanks, but it is not work. Clip lang is a strange animal???

      This is a copy from help:

      ^!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

      This is my try and error:
      H="TEST"
      ^!RunScript "c:\win98\wscript.exe" "C:\WIN98
      \Desktop\myScripts\test3.vbs"

      This is test1.js:
      WScript.Echo("Hello World!");

      This is test2.js:
      var NoteTabApp;
      NoteTabApp = new ActiveXObject("NoteTab.Application");
      NoteTabApp.writeln("This is a test");

      This is test3.vbs:
      MsgBox "Why is it so hard?"

      This is the result:
      Nothing happen!!!



      Could any one show me how to use the RunScript command? Thanks!
      Why don't just publish the clip language source, let us fully
      understand what it is mean and make it more completely?

      Jacob
    • Jody
      Hi Jacob, ... I don t know the script you are using, but you do have two typos that may be messing it up. The lines have spaces after them.
      Message 2 of 6 , Jul 17 5:45 AM
        Hi Jacob,

        >>> I am thinking in this way: Since we can get a copy of current
        >>> editing file in disk, why can I use any script or language to
        >>> control the current file? I am thinking using turbo pascal 7,
        >>> winTP1.5, Free TP, Qbasic, vbscript, jscript...to edit the
        >>> backup file then save it as current file. Is it possible? Is
        >>> anyone try this before?
        >>
        >> I think you can use the ^!RunScript command command to achieve
        >> it.
        >>
        >> Piotr
        >
        >'================================================================

        I don't know the script you are using, but you do have two typos
        that may be messing it up. The lines have spaces after them.

        \Desktop\myScripts\test3.vbs" <--- space at end
        WScript.Echo("Hello World!"); <--- space at end

        Your code is wrapped, too, but that might be the way it has to be,
        I think ^!RunScript should be one line.

        ^!RunScript "c:\win98\wscript.exe" "C:\WIN98\Desktop\myScripts\test3.vbs"

        >This is my try and error:
        >H="TEST"
        >^!RunScript "c:\win98\wscript.exe" "C:\WIN98
        >\Desktop\myScripts\test3.vbs"
        >
        >This is test1.js:
        >WScript.Echo("Hello World!");
        >
        >This is test2.js:
        >var NoteTabApp;
        >NoteTabApp = new ActiveXObject("NoteTab.Application");
        >NoteTabApp.writeln("This is a test");
        >
        >This is test3.vbs:
        >MsgBox "Why is it so hard?"
        >
        >This is the result:
        >Nothing happen!!!
        >
        >Could any one show me how to use the RunScript command? Thanks!
        >Why don't just publish the clip language source, let us fully
        >understand what it is mean and make it more completely?

        Try getting the syntax w/o spaces and line breaks where they are
        not suppose to be and run the Clip again.

        There's also ^!RunPerl and ^!RunGawk; ^$GetOutput()$ and
        ^$GetDosOutput()$ See Help | Help on Clipbook Programming (| Index
        to type commands and functions under):

        Apply Perl and Gawk Scripts on Text

        ^!RunGawk ScriptName
        ^!RunPerl ScriptName

        To do exactly what you want, even better, you'll need to wait on
        v5. We do not have an estimated time of release for v5, but it is
        being worked on. It will take quite awhile to complete though.
        The program is being rewritten from scratch.

        Take care,
        Jody Adair

        The whole world doth err save you and me,
        and even thou doest err some!
        http://clean-funnies.com
        http://notetab.net, http://fookes.us
      • Grant MacKenzie
        ... Jacob Your examples ... This is your test1.js: Note: CScript is the command prompt.. console version of the WSH ^!TextToFile ^$GetScriptPath$test1.js
        Message 3 of 6 , Jul 18 2:58 PM
          >Could any one show me how to use the RunScript command? Thanks!
          >Why don't just publish the clip language source, let us fully
          >understand what it is mean and make it more completely?

          Jacob
          Your examples ...

          This is your test1.js:
          Note: CScript is the command prompt.. console version of the WSH

          ^!TextToFile "^$GetScriptPath$test1.js" WScript.Echo('hello world')
          ^!Info ^$GetOutput(CScript "^$GetScriptPath$test1.js" //nologo)$

          This is test3.vbs:
          Note I'm reverting to wscript in this case
          Ref to Windows Script Host documentation for why...

          ^!TextToFile "^$GetScriptPath$test3.vbs" MsgBox "Why is it so hard?"
          ^!Info ^$GetOutput(WScript "^$GetScriptPath$test3.vbs")$

          This is your test2.js: Note; It's only 2 lines the email client cause a
          break

          ^!TextToFile "^$GetScriptPath$test2.js" try{var NoteTabApp = new
          ActiveXObject("NoteTab.Application");}catch(e){WScript.StdOut.Write(e.descri
          ption)}
          ^!Info ^$GetOutput(CScript "^$GetScriptPath$test2.js" //nologo)$

          I'm afraid no go....
          NoteTab functionality is not exposed as COM object...

          IMO the way Notetab handles console i/o makes it a great text editor
          Continue to play... you'll soon get the swing rocking.

          Grant
        • Alan C.
          Hi, ... [ . . ] http://groups.yahoo.com/group/ntb-scripts/message/277 There s one. http://groups.yahoo.com/group/ntb-scripts/messagesearch?query=runscript And,
          Message 4 of 6 , Jul 19 1:06 PM
            Hi,
            >>Could any one show me how to use the RunScript command? Thanks!
            >>Why don't just publish the clip language source, let us fully
            >>understand what it is mean and make it more completely?
            >
            > Jacob
            [ . . ]

            http://groups.yahoo.com/group/ntb-scripts/message/277

            There's one.

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

            And, there's more. (courtesy of the Search Archive feature).
            --

            ^!Set %ntpscripshort%=^$GetShort("^$GetScriptPath$")$
            ^!Set %myfile%=^**
            ^!Set %myfile%=^$GetShort("^%myfile%")$
            ^!RunScript "^$GetPerlExe$ ^1 ^%myfile%" "^%ntpscripshort%perltidy.pl"
            ; ----<end-clip<


            ^!Set %ntpscripshort%=^$GetShort("^$GetScriptPath$")$
            ^!Set %myfile%=^**
            ^!Set %myfile%=^$GetShort("^%myfile%")$
            ^!RunScript "^$GetPerlExe$ ^1 ^%myfile%" "^%ntpscripshort%tag2para.pl"
            ; ----<end-clip<

            There's two clips, each calls up a different Perl script. Pay particular attention to all of the getshort utilized as well as the double quotes utilized in the runscript lines.

            The perltidy.pl

            http://search.cpan.org/~shancock/Perl-Tidy-20031021/bin/perltidy

            I used it to run perltidy on a current Notetab doc that's a Perl script. That's pretty good, eh? -- that is, Tidy up a Perl script using Perl to do so. Like, run Perl (the perl engine) so as to work on a Perl script. (Notetab is the command central or traffic director for that); It worked very nicely. The tag to para, it converts html <p> tags into the text equivalent, substitutes each <p> with a blank line.
            --

            There's very little difference between runperl versus runscript. With Perl language, either of those two Notetab commands can be used but with one exception -- if you need parameter on the commandline then you must use runscript. If you need use of language engine other than Perl (with exception of runawk) then must use runscript.

            Notetab has two help files. Look in them for those two commands.

            My experience be in somewhat like fashion to that of what Grant shared with the exception that I found Notetab did/does it well enough that it (mostly--at least if not always at least worth a try anyways) warrants the use of these io thingys, output capturing, calling up external scripts on current doc, rather than limiting Notetab to the use of an excellent text editor. But, neither do I do what Grant does. Instead, my experience has been limited to calling perl and sometimes a few other external exe's

            Sometimes getoutput and getdosoutput can have inconsistencies. But the majority of the time it works rather than the inconsistency of it works in one situation while doesn't work in another.

            Notetab, however is VERY (repeat again: very) critical when it comes to what I importantly already mentioned which is worth mentioning again. And that is the getshort as well as the proper use of double quotes, ESPECIALLY SO (the double quotes) when it comes to a more complex commandline which I consider the above runscript lines to be just exactly that, towards a more complex commandline rather than a simpler, shorter one.

            --
            Alan.
          Your message has been successfully submitted and would be delivered to recipients shortly.