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

14976Re: [Clip] Understanding Writing Subroutines

Expand Messages
  • Alan_C
    Apr 13 2:10 PM
      On Thursday 13 April 2006 12:10, Don - htmlfixit.com wrote:
      > >>When calling the custom function (or sub-routine) you do not need to
      > >>use the ^!Clip command (even though you are calling a clip). When
      > >>NoteTab does not recognise the function name ^$m2y()$ it looks for a
      > >>clip m2y in your current library and starts it.
      > I think that to be bad form even if functional as using the command
      > makes it clearer what you are doing. It also has a much greater
      > probability of working over time should they later make an update to the
      > software as they almost always have reverse engineered commands and
      > functions.

      FWIW though, a (called, child) clip written by Fookes software calls (the
      child clip in turn then calls/uses) a custom function does so not via clip
      but via function name:

      ^!Set %Index%=0
      ^!Set %Count%=^%FieldNames0%

      ^!Inc %Index%
      ^!If ^%Index% > ^%Count% EndLoop
      ^!Set %FieldName%=^%FieldNames^%Index%%
      ^!IfTrue ^$IsEmpty(^%FieldName%)$ StartLoop
      ^!Set ^%FieldName%=^$GetXmlField(^%FieldName%)$





      That particular (sub routine) clip is near the bottom of PAD.clb

      Earlier, I'd overlooked the possibility of custom function.

      I never got much into custom function. I long since learned enough of Perl
      which happens to integrate well/nicely with Notetab.

      Learning curve for Perl (EZ stuff is EZ, happens quick in Perl) but to get to
      intermediate to advanced I found learn curve higher and longer than NTB clip.

      But I find that Perl uses way less code than clip. And (after some Perl
      experience) I find Perl significantly easier to track/follow/decipher than
      clip (for example, the PAD.clb to track/follow *understand* what makes it
      tick, how it does what it does) (decipher, key, *access* myself *into* it).

      Idiomatic Perl. get to know it and then now I got it. A *very* expressive
      language -- so much so that some do not like it because of the height of its
      expressivenes. I experience Perl as fun!

      But this is me. I've no idea if it's consensus of others or not. (obviously
      one needs to Perl in order to comment).

      So I (for myself) just write a Perl script/clip rather than a NTB custom

      And I didn't see a prob with:

      ; 4 speed and not see it happen
      ^!SetScreenUpdate OFF
      ^!Toolbar "new document"
      ; dump var's content to doc here
      ; etc.
      ^!select ALL
      ; back into var
      ^!Set %my_var%(get_selection)
      ; close discard doc here
      ; got what I wanted done onto my var's content

      Notetab lets us choose. We each get to do it how chosen. No prob with that!
      Must be good news!

      And a custom function only needs Notetab, not needs perl installed in the case
      of sharing clip library with other Notetab users.

    • Show all 11 messages in this topic