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

RE: [Clip] Editing Python scripts(is that parrot dead monty?)

Expand Messages
  • Grant
    ... You must have saved the python script you are working on with .py ext of course Then ^$GetDocName()$ gets the name of the current file. So the following
    Message 1 of 8 , Feb 1, 2001
      > Thanks for the help, it brings up a couple questions.
      >
      > How do I send the name of the current file instead of ^%PyFile% in
      > ^!INFO ^$GetOutput(python "^%PyFile%")$

      You must have saved the python script you are working on with .py ext of
      course
      Then ^$GetDocName()$ gets the name of the current file.
      So the following will send the current file to the python interpretor

      ^!Set %PyFile%=^$GetDocName()$
      ^!Info ^$GetOutput(python ^%PyFile%)$

      > Where is info on the function ^$getScriptPath()$

      In the help file i hope.
      Its just a folder in the ntab dir and is handy place to chuck your scripts,
      it serves no other intrinsic purpose.

      The active python distribution comes with a active x scripting engine
      (Python AXScript Engine) which you can use to run pythonScript in the wsh.
      Note the pys extension.

      H=pysInHost
      ^!Set %PyFile%=^$getScriptPath()$testingWSH.pys
      ^!Toolbar new document
      ;a 2 line python script
      import sys
      WScript.Echo("python version", sys.version)
      ^!Save as ^%PyFile%
      ;run python script in wsh host and get output
      ^!INFO ^$GetOutput(cscript "^%PyFile%")$
    • Kent Tenney
      Thanks for the help, it brings up a couple questions. How do I send the name of the current file instead of ^%PyFile% in ^!INFO ^$GetOutput(python
      Message 2 of 8 , Feb 2, 2001
        Thanks for the help, it brings up a couple questions.

        How do I send the name of the current file instead of ^%PyFile% in
        ^!INFO ^$GetOutput(python "^%PyFile%")$

        Where is info on the function ^$getScriptPath()$

        Thanks,
        Kent




        On Thu, 1 Feb 2001 23:34:57 +1300, Grant wrote:
        Hi kent
        > > What is the preferred method for editing scripts, sending them
        > > to the interpreter, and viewing the output of the script?
        This should get you started

        You can grab the output of a python script with notetabs
        ^$GetOutput()$ method

        H= pythonHelloWorldTest
        ;name the script to be placed in ntabs script folder
        ^!Set %PyFile%=^$getScriptPath()$test.py
        ^!Toolbar new document
        ;the 2 line python script
        print "hello hello"
        print "is that parrot dead monty?"
        ^!Save as ^%PyFile%
        ;run python script and get  output
        ^!INFO ^$GetOutput(python "^%PyFile%")$
      • Jody
        Hi Kent, Grant might give you the whole thing, but here ya go... ... GetInputOutput ^$GetInputOutput( Command )$ Launches the console program specified by
        Message 3 of 8 , Feb 2, 2001
          Hi Kent,

          Grant might give you the whole thing, but here ya go...

          >How do I send the name of the current file instead of ^%PyFile% in
          >^!INFO ^$GetOutput(python "^%PyFile%")$

          GetInputOutput
          ^$GetInputOutput("Command")$

          Launches the console program specified by "Command" and sends the
          current document text to the StdInput data stream. The function
          returns the console's StdOutput data stream. The stderr stream is
          saved in file called "StdError.err" in NoteTab's application
          directory unless another file is specified with the
          SetStdErrorName command. This command is only available in the
          commercial and trial versions of NoteTab.

          Try something like these:

          ; ^** = path to focused unsaved document if exists otherwise
          ; the path to the focused doc in saved state
          ^!Set %File%=^**
          ^!Info ^$GetInputOutput(python "^%File%")$

          ^!Set %File%=^?[(T=O)Get file path]
          ^!Info ^$GetInputOutput(python "^%File%")$

          > Where is info on the function ^$getScriptPath()$

          In Help under Clip Language - Disk Directories (I searched for
          GetScript under the Find tab). I'm not sure why Grant through in
          the "()" in the function except for you can do that in functions
          that don't normally have them.

          ^$GetScriptPath$
          Returns the path for NoteTab script files (e.g. AWK, Perl, etc.;
          always ends with backslash).

          I still use Wayne's Cross Reference which I try to update with
          commands and functions it is not all of them. Wayne has some
          nice Libraries at his site NoteAwk being the most talked about
          after the Cross Reference. ;)

          http://landru.myhome.net/wayne/notetab.html
          http://landru.myhome.net/wayne/ntr460.zip

          ^$GetScriptPath$
          Returns the path for NoteTab script files (e.g. AWK, Perl, etc.;
          always ends with backslash).

          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
        • Jody
          Hi Grant, ... It s in there, but do you add the parenthesis for anything special other than to keep Jody scratching his head? :) I suppose I will have to break
          Message 4 of 8 , Feb 2, 2001
            Hi Grant,

            >> Where is info on the function ^$getScriptPath()$
            >
            >In the help file i hope.

            It's in there, but do you add the parenthesis for anything
            special other than to keep Jody scratching his head? :)

            I suppose I will have to break down and install my VBscript
            stuff so I can try out your scripts.


            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
          Your message has been successfully submitted and would be delivered to recipients shortly.