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

Re: [Clip] Re: Running other programs with command lines

Expand Messages
  • Larry Thomas
    Hi dwc77 ... Try it like below and see what happens: ^!Shell C: Program Files Pretty HTML 3.7 prettyhtml.exe -ftba ^** From: Larry Thomas Date: Wed, 15 Nov
    Message 1 of 4 , Jul 10, 2004
    • 0 Attachment
      Hi dwc77

      At 09:25 AM 7/10/04 -0000, you wrote:
      >Thanks for quick answer John. I still cant get it to work for the
      >program i am currently wanting to use it for, its an old program
      >called Pretty Html, basically just arranges all the tags, inserts
      >comments, compresses etc in a very customizable way. Doesnt do
      >anything a clip couldnt do, but it would take an extremely complex
      >clip to equal it though. The company is no longer around so no
      >support, but no need for it really.
      >Anyway, from a regular command line it works fine;
      >
      >"C:\Program Files\Pretty HTML 3.7\prettyhtml.exe" -ftba
      >D:\folder\file.htm
      >
      >Those parameters open the program, apply formatting to the document,
      >and close the program. Works fine. But when i make the clip in
      >notetab like this;
      >
      >^!Shell "C:\Program Files\Pretty HTML 3.7\prettyhtml.exe" -ftba
      >$GetDocName$
      >^$GetDocName$
      >
      >It displays (prints) the document path where the cursor is and opens
      >the program, but nothing else. It looks to me like the document path
      >is not being supplied to (inserted into) the command line. I mean,
      >wouldnt you want to GetDocName first and then run the command line?
      >Well i tried it that way and it did the same thing. Anyone know
      >whats wrong here?
      >Folks, THIS is why command line stuff and programming in general is
      >so maddening to me, i always end up spending hours trying to get
      >something like this to work so i can save a few seconds. I have seen
      >many programmers and most of them still have their hair. How is this
      >possible?
      >Also, when you say "^** opens the current version in a temporary
      >file if it was not saved before running the clip", does that mean it
      >has to have been saved by notetab itself? In other words, what if
      >you just opened an existing document? Whats the purpose of this?

      Try it like below and see what happens:

      ^!Shell "C:\Program Files\Pretty HTML 3.7\prettyhtml.exe" -ftba "^**"

      From: Larry Thomas
      Date: Wed, 15 Nov 2000 09:51:07 -0600
      Subject: Re: [Clip] ^## [2]

      This clip shows the differences between ^** and ^## when displaying a
      modified file. There is no difference when displaying a saved file that
      has NOT been modified.

      ______[Copy below this line]_______
      ;
      ;----------------------[begin long line]---------------------------
      H="Current Document Name
      "
      ;-----------------------[end long line]----------------------------
      ;
      ^!Info [L]** : ^**^%nl%* : ^*^%nl%## : ^##^%nl%# : ^#
      _____[Copy above this line]______
      | right click over the clipbook |
      | and choose "Add from Clipboard" |
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      With a saved file that has been modified the output is:

      ** : C:\Program Files\NoteTab Pro\efo~1.txt
      * : C:\Program Files\NoteTab Pro\efo~1
      ## : C:\Program Files\NoteTab Pro\NoName06.txt
      # : C:\Program Files\NoteTab Pro\NoName06

      With a new unsaved document:

      ** : C:\Program Files\NoteTab Pro\efo~3.txt
      * : C:\Program Files\NoteTab Pro\efo~3
      ## : NoName01.txt
      # : NoName01

      With a saved and unmodified document:

      ** : C:\Program Files\NoteTab Pro\NoName06.txt
      * : C:\Program Files\NoteTab Pro\NoName06
      ## : C:\Program Files\NoteTab Pro\NoName06.txt
      # : C:\Program Files\NoteTab Pro\NoName06

      The efo~* files are temporary files created by NoteTab when you modify a
      document and they are deleted when you save the document. Thus the last
      example shows the same for ^** and for ^##.

      Regards,

      Larry
      lrt@... e¿ê
    • dwc77
      ... ftba ^** ... displaying a ... file that ... modify a ... the last ... That works great Larry, but i have no idea why. I appreciate the detailed answers
      Message 2 of 4 , Jul 10, 2004
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, Larry Thomas <larryt@c...> wrote:
        > Try it like below and see what happens:

        > ^!Shell "C:\Program Files\Pretty HTML 3.7\prettyhtml.exe" -
        ftba "^**"


        > This clip shows the differences between ^** and ^## when
        displaying a
        > modified file. There is no difference when displaying a saved
        file that
        > has NOT been modified.
        >
        > ______[Copy below this line]_______
        > ;
        > ;----------------------[begin long line]---------------------------
        > H="Current Document Name
        > "
        > ;-----------------------[end long line]----------------------------
        > ;
        > ^!Info [L]** : ^**^%nl%* : ^*^%nl%## : ^##^%nl%# : ^#
        > _____[Copy above this line]______
        > | right click over the clipbook |
        > | and choose "Add from Clipboard" |
        > ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
        >
        > With a saved file that has been modified the output is:
        >
        > ** : C:\Program Files\NoteTab Pro\efo~1.txt
        > * : C:\Program Files\NoteTab Pro\efo~1
        > ## : C:\Program Files\NoteTab Pro\NoName06.txt
        > # : C:\Program Files\NoteTab Pro\NoName06
        >
        > With a new unsaved document:
        >
        > ** : C:\Program Files\NoteTab Pro\efo~3.txt
        > * : C:\Program Files\NoteTab Pro\efo~3
        > ## : NoName01.txt
        > # : NoName01
        >
        > With a saved and unmodified document:
        >
        > ** : C:\Program Files\NoteTab Pro\NoName06.txt
        > * : C:\Program Files\NoteTab Pro\NoName06
        > ## : C:\Program Files\NoteTab Pro\NoName06.txt
        > # : C:\Program Files\NoteTab Pro\NoName06
        >
        > The efo~* files are temporary files created by NoteTab when you
        modify a
        > document and they are deleted when you save the document. Thus
        the last
        > example shows the same for ^** and for ^##.
        > Regards,
        > Larry
        > lrt@n... e¿ê

        That works great Larry, but i have no idea why. I appreciate the
        detailed answers from you guys, but heres the problem. I can see so
        many possibilities for clips and i could come here everyday for
        months with numerous questions on how to make and use them, but i
        would quickly feel like i was imposing. I would like to at least
        learn how to do (or figure out) the simple stuff myself, and i
        thought running a command line on the current document whould be
        about as simple as you can get. Yet, i could have spent many many
        hours looking through the help docs and would never have figured out
        how to do it this way. I mean, logic would tell me that
        ^!CommandLine is used to run command lines and also i would have
        thought that ^$GetDocName$ and $GetDocName$ (or perhaps instead
        ^$GetDocumentPath$) would be used to find and insert the document
        name. In the help files it states that "^$GetDocName$ returns the
        active document name, if no index is specified, or the document name
        at specified index position." Of course we are just supposed to
        already know what "index position" means, no info on that is
        anywhere to be found. This is a classic example of how the help
        files are often useless to those who are not already knowledgeable
        about programming. Anyway i still have no clue why this doesnt work;
        ^$GetDocName$
        ^!CommandLine C:\P..Files\folder\prog.exe parameters $GetDocName$

        So, does this mean that whenever we want to insert the path of the
        current document somewhere (in a command line or elsewhere) then we
        should use ^** or ^## there? And why is ^!Shell used instead of
        ^!CommandLine to run a command line? I dont get the logic of it, but
        if i can just learn some of the basic rules of thumb like this it
        would be very helpful. The real problem is that the author of this
        program has (evidently) spent a great deal of time writing the clip
        help files, but they are mostly useless to 99% of the population.
        Simple things like this should be easy to look up and figure out,
        but they arent.
      • loro
        Hello, ... I don t think there is a ^!CommandLine command. The CommandLine bit is just sample text representing the actual command line, just as it s
        Message 3 of 4 , Jul 10, 2004
        • 0 Attachment
          Hello,

          dwc77 wrote:
          >. Anyway i still have no clue why this doesnt work;
          >^$GetDocName$
          >^!CommandLine C:\P..Files\folder\prog.exe parameters $GetDocName$

          I don't think there is a "^!CommandLine" command. The CommandLine bit is
          just sample text representing the actual command line, just as it's
          expressed with the ^!Shell command.

          ^!Shell CommandLine
          ^!CommandLine

          The problem here is that there is no space in-between, hence gets
          confusing. I think it used to be expressed differently or I sure would have
          misunderstood that too! So, to start the calculator you don't write
          ^!CommandLine calc.exe
          You write
          ^!calc.exe
          Anyway, "^!Shell" is replacing the older "^!" so I guess that's what we
          should use.

          Next, when you use a function, basically as soon as whatever-it-is *does*
          something, it's always prefixed with a circumflex. So if you change your
          line to the below it will hopefully work.

          ^!C:\P..Files\folder\prog.exe parameters "^$GetDocName$" (I assume the
          path needs to be quoted)

          You had ^$GetDocName$ (with the circumflex!) on the line above the actual
          command. Don't know why you put it there but it doesn't do anything.


          Lotta
        • Larry Thomas
          ... The problem with your command line appears to be the missing double quotes ( ). You have: ^!Shell C: Program Files Pretty HTML 3.7 prettyhtml.exe -ftba
          Message 4 of 4 , Jul 10, 2004
          • 0 Attachment
            At 12:35 AM 7/11/04 -0000, you wrote:

            >That works great Larry, but i have no idea why. I appreciate the
            >detailed answers from you guys, but heres the problem. I can see so
            >many possibilities for clips and i could come here everyday for
            >months with numerous questions on how to make and use them, but i
            >would quickly feel like i was imposing. I would like to at least
            >learn how to do (or figure out) the simple stuff myself, and i
            >thought running a command line on the current document whould be
            >about as simple as you can get. Yet, i could have spent many many
            >hours looking through the help docs and would never have figured out
            >how to do it this way. I mean, logic would tell me that
            >^!CommandLine is used to run command lines and also i would have
            >thought that ^$GetDocName$ and $GetDocName$ (or perhaps instead
            >^$GetDocumentPath$) would be used to find and insert the document
            >name. In the help files it states that "^$GetDocName$ returns the
            >active document name, if no index is specified, or the document name
            >at specified index position." Of course we are just supposed to
            >already know what "index position" means, no info on that is
            >anywhere to be found. This is a classic example of how the help
            >files are often useless to those who are not already knowledgeable
            >about programming. Anyway i still have no clue why this doesnt work;
            >^$GetDocName$
            >^!CommandLine C:\P..Files\folder\prog.exe parameters $GetDocName$

            The problem with your command line appears to be the missing double quotes
            (").

            You have:

            ^!Shell "C:\Program Files\Pretty HTML 3.7\prettyhtml.exe" -ftba $GetDocName$
            ^$GetDocName$

            You should get rid of the first $GetDocName$. It is missing the leading
            circumflex (^) anyway. And then you should place a couple of double quotes
            areound it to handle any spaces that might be included in the pathname.
            Like below:

            ^!Shell "C:\Program Files\Pretty HTML 3.7\prettyhtml.exe" -ftba
            "^$GetDocName$"

            In actual fact in most cases ^!Commandline should work just as well as
            ^!Shell Commandline:

            ^!"C:\Program Files\Pretty HTML 3.7\prettyhtml.exe" -ftba "^$GetDocName$"

            Should work the same a with the ^!Shell command. Eric added this command
            and I don't know what the difference is with the previous way of doing it.
            Most of the time I use the old way and don't use the ^!Shell Command at all
            but sometimes it just does not work for some things and then I try it and
            it works. Maybe Eric or Jody will see this and explain.

            I find that if I want to open Explorer on NoteTab's home folder, I can use:

            ^!C:\WINDOWS\EXPLORER.EXE /e,^$GetAppPath$

            Works perfectly fine and dandy so there. But what if I want to open the
            folder for NoteTab like you do when you are in Explorer and you click on
            the folder icon. I would use:

            ^!^$GetAppPath$

            And I get a nasty syntax error! So I use:

            ^!Shell "^$GetAppPath$"

            And it works like a charm. Why??? I don't know. And I don't know why I
            need double quotes in the last example but not in the
            ^!C:\WINDOWS\EXPLORER.EXE /e,^$GetAppPath$ example.

            What you have to do is start out slow and play with the commands. Read the
            help and try things to see how they work. Most of the time you are not
            going to break anything and there are things you can do to protect yourself
            while you are trying things out. Make up test clipbooks and create junk
            clips to test how various commands work. Use things such as the ^!Info
            command with variables to test what is happening when you run a command.
            Example: What do you actual get with ^$GetDocName$ ? Well create a junk
            clip:

            ^!Info ^$GetDocName$

            And run it with different documents in focus, both saved and new unsaved
            and modified and see what you get. That is how I wrote the clip to show
            what ^** and ^## do because I was curious.

            ^!Goto Exit will act as a temporary break in your clip to see what happens
            up to that point when you are writing a large complicated clip. And you
            can highlight the ^!Goto Exit line and drag it up and down through your
            code and drop it in a different place to test the code to that point and
            when you want to run the code without it temporarily, you can comment it out:

            ;^!Goto Exit

            You can also use ^!SetDebug ON/OF 1 or 0 to step though a running clip or
            part of one. There are many many things like this that you can do and just
            play with it and after bit you will begin to see a pattern and remember
            things and pretty soon you will be writing your own useful clips. You can
            also go to NoteTab's Clipbook libraries located at:

            http://www.notetab.com/libraries.php

            And Jody Adair's website at:

            http://www.notetab.net

            and download various clipbook libraries to study to see how others wrote
            clips and you can study the clips Eric has provided with the program as
            well. And of coarse, you can always ask for help here if you get stuck on
            anything. There are plenty of people who are ready and willing to help.

            Good Luck.






            Regards,

            Larry
            lrt@... e¿ê
          Your message has been successfully submitted and would be delivered to recipients shortly.