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

Re: [Clip] Re: Append Question Answered

Expand Messages
  • Wayne VanWeerthuizen
    ... Well, here is one way to do it, based on dynamically creating a new clip containing the desired function. It turned out to be easier, shorter, and faster
    Message 1 of 17 , Jan 13 1:36 AM
      I recently wrote:

      >Still I know no way to build a function using strings
      >or user input, and then actually get NoteTab to evaluate
      >it. (Well, short of dynamically creating a new clip
      >containing the desired function.)
      >
      >I am skeptical of whether the task can even be accomplished,
      >as I've tried several different approaches already. Still, I
      >am hoping Eric can point out some detail I've missed and
      >suggest a way the task could be accomplished.

      Well, here is one way to do it, based on dynamically creating
      a new clip containing the desired function. It turned out to
      be easier, shorter, and faster than I anticipated. I kinda
      like this clip. ;-)


      H="Eval"
      ; Clip From Wayne VanWeerthuizen
      ; version 1.1, 2001-Jan-13
      ; wayne@...
      ; http://landru.myhome.net/wayne
      ^!Set %Name%="WMV.TemporaryClipbook.clb"
      ^!Set %Path%="^$GetLibraryPath$"
      ^!RecycleFile ^%Path%^%Name%
      ^!AppendToFile "^%Path%^%Name%" = V5 MultiLine NoSorting TabWidth=30
      ^!AppendToFile "^%Path%^%Name%" ^%NL%^%NL%H="Eval"
      ^!AppendToFile "^%Path%^%Name%" ^%NL%^%caret%!SetClipboard ^&^%NL%
      ^!ClipboardSave
      ^!FarClip "^%Name%:Eval"
      ^!Result ^$GetClipboard$
      ^!ClipboardRestore
      ^!DeleteFile ^^%Path%^%Name%


      Here is an example of how to call the Eval function.

      H="Test Eval Function."
      ^!Set %Fun%=^?{Choose Function=_GetDate|GetRow|GetLineCount}
      ^!Info ^$Eval("^%caret%$^%Fun%$")$




      The above Eval clip is general purpose and can be used in
      any library where an Eval function is needed.

      Be aware of some minor side effects:

      1. While the clipboard is not affected, the ClipBoardSave
      buffer is. Don't call this function form clips relying
      on ClipboardSave.

      2. It doesn't work "about the current clip" type
      functions such as ^$GetClipName$ or ^$GetLibraryName$


      --
      Wayne M. VanWeerthuizen
      Homepage: http://landru.myhome.net/wayne
    • Larry Hamilton
      Wayne, I have seen you other post with the dynamic clip, but I am wondering if the answer lies in the way that Eric changed the clip parser to not execute clip
      Message 2 of 17 , Jan 13 6:56 PM
        Wayne,

        I have seen you other post with the dynamic clip, but I am wondering if the
        answer lies in the way that Eric changed the clip parser to not execute
        clip commands in text? I guess Eric will have to let us know if he can or
        will allow this.

        Larry

        At 12:33 AM 01/13/2001 -0800, you wrote:
        >Thanks for the tip. I tested the clip with your change and
        >now the clip "fails more gracefully." It displays the name
        >of the function, but still does not execute it. I actually
        >already knew of this "fix", but thought that the particular
        >strange behavior of the clip as I presented it was evidence
        >of a subtle problem with the clip parser.
      • Jody
        Hi Larry, Wayne, and Anybody interested, ... Prior to v4.8 we were allowed to type functions into wizards. Eric did quite a bit of work on the way they were
        Message 3 of 17 , Jan 15 12:07 AM
          Hi Larry, Wayne, and Anybody interested,

          >I have seen you other post with the dynamic clip, but I am
          >wondering if the answer lies in the way that Eric changed the
          >clip parser to not execute clip commands in text? I guess Eric
          >will have to let us know if he can or will allow this.

          Prior to v4.8 we were allowed to type functions into wizards.
          Eric did quite a bit of work on the way they were parsed in the
          4.8 versions starting with v4.80 and that is when we got our
          first cheat sheet of the parsing order. The reason why we cannot
          type them in now is because functions are evaluated before braced
          wizards. Therefore, when the wizard pops up, you are past the
          point for NoteTab to evaluate and execute the function so it is
          treated as text as we all saw.

          I only know of the ^!Append workaround that you all were playing
          with. The same works in reverse when you are trying to prevent a
          wizard or function from being executed. Instead of building it,
          you are taking it apart to say insert into a document.

          Happy Clip'n!
          Jody

          http://www.notetab.net

          Subscribe, UnSubscribe, Options
          mailto:Ntb-Clips-Subscribe@...
          mailto:Ntb-Clips-UnSubscribe@...
          http://www.egroups.com/group/ntb-clips
        Your message has been successfully submitted and would be delivered to recipients shortly.