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

Re: [NTB] Clip on File->Save?

Expand Messages
  • Grant
    To avoid wrath of J I ve replied on this list. Reply to Richard request from basic list Richard said ... Open the html doc in Notetab Run this clip once only.
    Message 1 of 6 , Jul 31, 2000
    • 0 Attachment
      To avoid wrath of J I've replied on this list.
      Reply to Richard request from basic list

      Richard said
      > Sorry if this is a question for the clips list or the HTML list, but
      > I'm a new NoteTab user and I have what I hope is a simple question.
      >
      > When I edit an HTML file, the standard format for my site is that the
      > last line before the </body></html> tags is a "Last modified:" line
      > with the current date. My question is, can I (with clips or any other
      > way) set things up so that when I save the file, the date gets
      > automatically updated?

      Open the html doc in Notetab
      Run this clip once only.
      It will insert A simple piece of javascript that will do the trick.

      H=lastModified
      ^!Find "</body" CIWS
      ^!Jump SELECT_START
      ^%NL%<script language="javascript" type="text/javascript">
      document.write('<hr /><p>lastModified: ' + document.lastModified + '</p>')
      </script>^%NL%
      ^!Save
    • Richard S. Smith
      Grant, that s a clever and elegant solution. Thanks. Unfortunately it won t work for me because I have to support multiple browsers including Lynx, so
      Message 2 of 6 , Aug 1 2:30 AM
      • 0 Attachment
        Grant, that's a clever and elegant solution. Thanks. Unfortunately
        it won't work for me because I have to support multiple browsers
        including Lynx, so relying upon JavaScript behavior is a non-starter.

        So, I'm back to my original question, which is, can I "hook" a menu
        event like File->Save and "bind" a Clip to it? It's looking more and
        more like the answer is "No", so I guess I'll just write the Clip to
        do the text substitution and then instruct my users to manually run
        the clip when they need to save.

        I'm a tad disappointed that I can't make it into a passive, automated
        process, though. I guess I'm spoiled by Emacs, which allows you to
        bind code just about anywhere. But if NT-Emacs weren't so unfriendly
        to novice users, I wouldn't be using NoteTab, now would I? :-)

        Thanks again for the help.

        emerge@... (Grant) wrote:
        > Richard said
        > > Sorry if this is a question for the clips list or the HTML list, but
        > > I'm a new NoteTab user and I have what I hope is a simple question.
        > >
        > > When I edit an HTML file, the standard format for my site is that the
        > > last line before the </body></html> tags is a "Last modified:" line
        > > with the current date. My question is, can I (with clips or any other
        > > way) set things up so that when I save the file, the date gets
        > > automatically updated?
        >
        > Open the html doc in Notetab
        > Run this clip once only.
        > It will insert A simple piece of javascript that will do the trick.
        >
        > H=lastModified
        > ^!Find "</body" CIWS
        > ^!Jump SELECT_START
        > ^%NL%<script language="javascript" type="text/javascript">
        > document.write('<hr /><p>lastModified: ' + document.lastModified + '</p>')
        > </script>^%NL%
        > ^!Save

        --
        --------------------------------------------------------------------------
        Richard S. Smith / Email: rss@... / Web: http://www.idiom.com/~rss
        --------------------------------------------------------------------------
      • Larry Hamilton
        Hi Richard,On Tue, 1 Aug 2000 02:30:46 -0700, ntb-html@egroups.com wrote: Grant, that s a clever and elegant solution. Thanks. Unfortunately it won t
        Message 3 of 6 , Aug 1 6:04 AM
        • 0 Attachment
          Hi Richard,

          On Tue, 1 Aug 2000 02:30:46 -0700, ntb-html@egroups.com wrote:
          >Grant, that's a clever and elegant solution. Thanks. Unfortunately
          >it won't work for me because I have to support multiple browsers
          >including Lynx, so relying upon JavaScript behavior is a
          non-starter.

          Here are two clips I use. One I made to change the last updated date
          for all open documents, you may need to tweak for the way you need it
          to work. The other clip is for updating only one document. If it is a
          new document, you can use a template with the code, or use the HTML
          clip library, which includes that information.

          If you are only saving the date, you could create a clip library with
          an on Open event, so that when the clip is selected it would find the
          open htm/html documents that you have open for editing, and update
          the dates.

          ______[Copy below this line]_______
          H="Find Last Updated-All Docs"
          ;Larry Hamilton, Jr. <lm_hamilton@...>
          ;08/01/2000, 07:55:31 AM
          ^!Set %COUNTER%=0
          ^!Set %DocCount%=^$GetDocCount$
          ^!StatusClose
          ^!StatusShow Updating "Last Updated"
          :LOOP
          ^!Inc:%COUNTER%
          ^!SetDocIndex ^%COUNTER%

          ^!IF ^%COUNTER% > ^%DocCount% END ELSE NEXT
          ^!Open ^$GetDocName(^%COUNTER%)$
          ^!Find "Last updated " GW
          ;^!Find "<B>" IS
          ^!IfError End
          ^!Select 0
          ^!Set %End%=^$GetRow$:^$GetCol$
          ^!SetCursor ^%Start%
          ^!SelectTo ^%End%
          ^!Keyboard DELETE
          ^$GetDate(mmmm dd, yyyy)$
          ;^!Keyboard CTRL+V
          ^!Goto LOOP
          ;^!Save
          _____[Copy above this line]______
          | right click over the clipbook |
          | and choose "Add from Clipboard" |
          ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

          ______[Copy below this line]_______
          H="Last Updated for 1 Doc"
          ;Larry Hamilton, Jr. <lm_hamilton@...>
          ;08/01/2000, 07:59:23 AM
          ^!SetCursor 1:1
          ^!Find "Last updated "
          ^!Jump SELECT_END
          ;^!Find <p> IS
          ;^!Jump SELECT_END
          ^!Set %Start%=^$GetRow$:^$GetCol$
          ^!Find </p> IS
          ^!IfError End
          ^!Select 0
          ^!Set %End%=^$GetRow$:^$GetCol$
          ^!SetCursor ^%Start%
          ^!SelectTo ^%End%
          ^!Keyboard DELETE
          ^$GetDate(mmmm dd, yyyy)$
          ^!Save
          _____[Copy above this line]______
          | right click over the clipbook |
          | and choose "Add from Clipboard" |
          ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

          -- Larry Hamilton, lm_hamilton@... on 08/01/2000


          __________________________________________________
          Do You Yahoo!?
          Talk to your friends online with Yahoo! Messenger.
          http://im.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.