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

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

Expand Messages
  • Grant
    Hi kent ... This should get you started You can grab the output of a python script with notetabs ^$GetOutput()$ method H= pythonHelloWorldTest ;name the script
    Message 1 of 8 , Feb 1, 2001
    • 0 Attachment
      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%")$
    • 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 2 of 8 , Feb 1, 2001
      • 0 Attachment
        > 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%")$
      • Jody
        Hi Kent, ... For help with Python you need to post on the Off-Topic list for it, but you should be able to figure out what you need from the following. I like
        Message 3 of 8 , Feb 1, 2001
        • 0 Attachment
          Hi Kent,

          > What is the preferred method for editing scripts, sending them
          > to the interpreter, and viewing the output of the script?

          For help with Python you need to post on the Off-Topic list for
          it, but you should be able to figure out what you need from the
          following.

          I like to use the clip Editor for editing and writing scripts.
          Right click over any Clip in a Library and click on "Edit Clip."
          Also see "Add New Clip" and "Add from Clipboard".

          Scripts have all different kinds of "outputs" depending on what
          you are trying to do and with what and what OS you are using.
          You might take a look at the following for the output of apps:

          ^$GetDosOutput("Command")$
          Example: ^$GetOutput(dir c:\*.*)$
          ^$GetOutput("Command")$
          Example: ^$GetOutput(command.com /c dir c:\*.*)$

          <--- Copy below this line --->
          H=Peekers ;)
          ; Last Updated 02-02-2001, Sojourner@..., jody
          ; Set these in places in your script to stop the script
          ; until you take action. You can use ^!Continue, ^!Info,
          ; ^!Prompt... to "peek" at a Clip while running.

          ^!Set %Hi%=Hello World!
          ^!Continue ^%Hi%
          ^!Info ^%Hi%
          ^!Prompt ^$GetRow$:^$GetCol$
          ^!IfTrue ^$IsCtrlKeyDown$ Next else Exit
          ^!Info Right click for a content menu.

          <--- Copy above this line, right --->
          <--- click over a Library, and --->
          <--- choose "Add from Clipboard" --->

          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
        • Larry Hamilton
          And now for something completely different! LOL! ... Larry Hamilton, Jr. lm_hamilton@yahoo.com http://notlimah.tripod.com/ Hamilton National Genealogical
          Message 4 of 8 , Feb 2, 2001
          • 0 Attachment
            And now for something completely different! LOL!

            On 1 Feb 2001, at 23:34, Grant wrote:
            > ;the 2 line python script
            > print "hello hello"
            > print "is that parrot dead monty?"

            Larry Hamilton, Jr.
            lm_hamilton@...
            http://notlimah.tripod.com/
            Hamilton National Genealogical Society, Inc.
            http://www.hamiltongensociety.org/
          • 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 5 of 8 , Feb 2, 2001
            • 0 Attachment
              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 6 of 8 , Feb 2, 2001
              • 0 Attachment
                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 7 of 8 , Feb 2, 2001
                • 0 Attachment
                  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.