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

Re: [Clip] Simple array processing in a Clip

Expand Messages
  • Peter Anderson
    ... Thanks Evert and Alex. I probably did not make myself clear enough in my original post. I want to be able to click on a Clip Library and have a pop up
    Message 1 of 5 , Nov 5, 2006
      --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
      >
      > Peter Anderson wrote:
      > > select one of the displayed values the clip puts a corresponding
      > > value into the document being edited at the cursor position.
      >
      Thanks Evert and Alex. I probably did not make myself clear enough in
      my original post. I want to be able to click on a Clip Library and
      have a pop up list that showed me the three (or more) choices ("AAA",
      "BBB" and "CCC"). On choosing one, say "BBB", the Clip would insert
      the corresponding value, "222" in this case, into the document.

      The code that I have been playing with looks something like:

      H="Test clip"
      ^!SetWizardTitle "Insert a card suit code"
      ;^?[Choose a suit=Spades|Hearts|Diamonds|Clubs]
      ^!Set %NewVariable%=^?{Choose a suit==_Spades|Hearts|Diamonds|Clubs}
      ^!InsertText %NewVariable%

      But of course is not working (yet!).

      Regards,
      Peter
    • Peter Anderson
      ... The above was not very clear, another bit of code goes like this: H= Card Suits ^!ClearVariables ^!SetArray
      Message 2 of 5 , Nov 5, 2006
        --- In ntb-clips@yahoogroups.com, "Peter Anderson" <pjafrombbay@...>
        wrote:
        >
        > The code that I have been playing with looks something like:
        >
        > H="Test clip"
        > ^!SetWizardTitle "Insert a card suit code"
        > ;^?[Choose a suit=Spades|Hearts|Diamonds|Clubs]
        > ^!Set %NewVariable%=^?{Choose a suit==_Spades|Hearts|Diamonds|Clubs}
        > ^!InsertText %NewVariable%
        >
        > But of course is not working (yet!).
        >
        The above was not very clear, another bit of code goes like this:

        H="Card Suits"
        ^!ClearVariables
        ^!SetArray %Suit%="♠";"♥";"♦";"♣"
        ^!SetWizardLabel "Select the required suit"
        ^!InsertWizardHtml "^?{Spades|Hearts|Diamonds|Clubs}"
        ^!Set %VariableName%=Data

        This example is even less successful. I am actually trying to replace
        words with equivalent HTML character codes.

        Peter
      • Peter Anderson
        ... Alex and Evert, Thank you both! The following works a treat: H= Card Suits ^!InsertHtml
        Message 3 of 5 , Nov 5, 2006
          --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
          >
          > Peter Anderson wrote:
          > > select one of the displayed values the clip puts a corresponding
          > > value into the document being edited at the cursor position.
          >
          > ^!InsertHtml ^?[(T=L)Variable=AAA|_BBB|CCC|DDD]
          >
          Alex and Evert,

          Thank you both! The following works a treat:

          H="Card Suits"
          ^!InsertHtml
          ^?[(T=L)Suit=_Spades^=♠|Hearts^=♥|Diamonds^=♦|Clubs^=♣]

          *** The actual clip is one line, broken by the list editor. ***

          This will be very useful for a whole lot of other clips I have in
          mind. I do most of my writing using a text editor to produce HTML
          code rather than ".doc" or ".rtf". The above clip is part of a
          "normal(dot)html" clip library.

          For my future benefit, can you explain several things for me?

          1. The meaning of the (T=L) phrase
          2. ^= I assume means 'transpose' or replace

          Thanks again for your valuable help.

          Regards,
          Peter
        • Sheri
          ... You need a caret in front of %NewVariable% where you want to substitute the value it is holding: ^!InsertText ^%NewVariable% Regards, Sheri
          Message 4 of 5 , Nov 5, 2006
            --- In ntb-clips@yahoogroups.com, "Peter Anderson" <pjafrombbay@...>
            wrote:

            > H="Test clip"
            > ^!SetWizardTitle "Insert a card suit code"
            > ;^?[Choose a suit=Spades|Hearts|Diamonds|Clubs]
            > ^!Set %NewVariable%=^?{Choose a suit==_Spades|Hearts|Diamonds|Clubs}
            > ^!InsertText %NewVariable%
            >
            > But of course is not working (yet!).
            >

            You need a caret in front of %NewVariable% where you want to substitute
            the value it is holding:

            ^!InsertText ^%NewVariable%

            Regards,
            Sheri
          Your message has been successfully submitted and would be delivered to recipients shortly.