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

Search for selected text

Expand Messages
  • ehofferino
    Not sure why the following clip, which should only prompt for a search term if there s no text selected in NT, prompts me for a search term even when there is
    Message 1 of 6 , Oct 4, 2009
    • 0 Attachment
      Not sure why the following clip, which should only prompt for a search term if there's no text selected in NT, prompts me for a search term even when there is text selected:

      ^!Set %SearchTerm%=^$GetSelection$
      ^!IfEmpty ^%SearchTerm% ^!Set %SearchTerm%=^?[Symbol]
      ^!Url http://news.google.com/news?hl=en&ned=&ie=UTF-8&q=^%SearchTerm%&scoring=n
      ^!ClearVariables
    • Sheri
      ... If there are square bracket type wizards anywhere in a clip, they are presented before any other code is processed. You need curly brackets if you want the
      Message 2 of 6 , Oct 4, 2009
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "ehofferino" <eyhoffmann@...> wrote:
        >
        > Not sure why the following clip, which should only prompt for a search term if there's no text selected in NT, prompts me for a search term even when there is text selected:
        >
        > ^!Set %SearchTerm%=^$GetSelection$
        > ^!IfEmpty ^%SearchTerm% ^!Set %SearchTerm%=^?[Symbol]
        > ^!Url http://news.google.com/news?hl=en&ned=&ie=UTF-8&q=^%SearchTerm%&scoring=n
        > ^!ClearVariables
        >

        If there are square bracket type wizards anywhere in a clip, they are presented before any other code is processed. You need curly brackets if you want the wizard to be evaluated inline with the rest of the code.

        Also, IMO you should avoid the ^!ClearVariables command, and only specifically clear any variables used by your clip.

        ^!ClearVariable %SearchTerm%

        OTH, if you don't clear %searchterm%, you could use it in your wizard to show what was last used ^?{Symbol=^%SearchTerm%}

        That sort of usage is unproductive if any of the clips you run prior to re-running this one randomly clears all variables with ^!ClearVariables.

        Regards,
        Sheri
      • flo.gehrke
        ... Sheri, For me, the Wizard pops up in any case -- even with curly braces. Could there be something wrong with an If that is followed by a Wizard on the same
        Message 3 of 6 , Oct 4, 2009
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
          >
          > If there are square bracket type wizards anywhere in a clip, they
          > are presented before any other code is processed. You need curly
          > brackets if you want the wizard to be evaluated inline with the
          > rest of the code.

          Sheri,

          For me, the Wizard pops up in any case -- even with curly braces.

          Could there be something wrong with an If that is followed by a Wizard on the same line? At first glance, this should comply with the syntax (since NT v4.8).

          For example, with...

          ^!Set %SearchTerm%="Mary"
          ^!If "^%SearchTerm%" <> "Mary" ^!Set %SearchTerm%=^?{Symbol}
          ^!Info ^%SearchTerm%

          the wizard pops up as well.

          There's no problem when placing the Wizard in a separate line...

          ^!Set %SearchTerm%=^$GetSelection$
          ^!IfEmpty ^%SearchTerm% Next Else Skip
          ^!Set %SearchTerm%=^?{Symbol}

          It also works with a simple ^!Set command (without Wizard) on the same line like...

          ^!Set %SearchTerm%=^$GetSelection$
          ^!IfEmpty ^%SearchTerm% ^!Set %SearchTerm%="Nothing selected"
          ^!Info ^%SearchTerm%
          ^!ClearVariable %SearchTerm%

          Regards,
          Flo
        • Sheri
          ... I haven t tried it (I don t use the multi-command syntax), but based on what you ve said, I agree it seems strange. Most likely curly braced wizards are
          Message 4 of 6 , Oct 4, 2009
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
            >
            > --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@> wrote:
            > >
            > > If there are square bracket type wizards anywhere in a clip, they
            > > are presented before any other code is processed. You need curly
            > > brackets if you want the wizard to be evaluated inline with the
            > > rest of the code.
            >
            > Sheri,
            >
            > For me, the Wizard pops up in any case -- even with curly braces.
            >
            > Could there be something wrong with an If that is followed by a Wizard on the same line? At first glance, this should comply with the syntax (since NT v4.8).
            >
            > For example, with...
            >
            > ^!Set %SearchTerm%="Mary"
            > ^!If "^%SearchTerm%" <> "Mary" ^!Set %SearchTerm%=^?{Symbol}
            > ^!Info ^%SearchTerm%
            >
            > the wizard pops up as well.
            >
            > There's no problem when placing the Wizard in a separate line...
            >
            > ^!Set %SearchTerm%=^$GetSelection$
            > ^!IfEmpty ^%SearchTerm% Next Else Skip
            > ^!Set %SearchTerm%=^?{Symbol}
            >
            > It also works with a simple ^!Set command (without Wizard) on the same line like...
            >
            > ^!Set %SearchTerm%=^$GetSelection$
            > ^!IfEmpty ^%SearchTerm% ^!Set %SearchTerm%="Nothing selected"
            > ^!Info ^%SearchTerm%
            > ^!ClearVariable %SearchTerm%
            >

            I haven't tried it (I don't use the multi-command syntax), but based on what you've said, I agree it seems strange. Most likely curly braced wizards are currently evaluated before the rest of a whole command LINE, (disregarding that the wizard might be inside a secondary conditional command).

            Thanks,
            Sheri
          • ehofferino
            Indeed, my experience is the same - no difference between brackets or curly braces, but using the If...Next...Else...Skip formula seems to have done the trick.
            Message 5 of 6 , Oct 4, 2009
            • 0 Attachment
              Indeed, my experience is the same - no difference between brackets or curly braces, but using the If...Next...Else...Skip formula seems to have done the trick.

              Is this a bug, or the expected behavior?

              --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
              >
              > --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@> wrote:
              > >
              > > If there are square bracket type wizards anywhere in a clip, they
              > > are presented before any other code is processed. You need curly
              > > brackets if you want the wizard to be evaluated inline with the
              > > rest of the code.
              >
              > Sheri,
              >
              > For me, the Wizard pops up in any case -- even with curly braces.
              >
              > Could there be something wrong with an If that is followed by a Wizard on the same line? At first glance, this should comply with the syntax (since NT v4.8).
              >
              > For example, with...
              >
              > ^!Set %SearchTerm%="Mary"
              > ^!If "^%SearchTerm%" <> "Mary" ^!Set %SearchTerm%=^?{Symbol}
              > ^!Info ^%SearchTerm%
              >
              > the wizard pops up as well.
              >
              > There's no problem when placing the Wizard in a separate line...
              >
              > ^!Set %SearchTerm%=^$GetSelection$
              > ^!IfEmpty ^%SearchTerm% Next Else Skip
              > ^!Set %SearchTerm%=^?{Symbol}
              >
              > It also works with a simple ^!Set command (without Wizard) on the same line like...
              >
              > ^!Set %SearchTerm%=^$GetSelection$
              > ^!IfEmpty ^%SearchTerm% ^!Set %SearchTerm%="Nothing selected"
              > ^!Info ^%SearchTerm%
              > ^!ClearVariable %SearchTerm%
              >
              > Regards,
              > Flo
              >
            • ebbtidalflats
              ... I think this has something to do with the way NoteTab parses lines, from the RIGHT. Which means it parses the wizard before it parses the test. This
              Message 6 of 6 , Oct 8, 2009
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
                > ...

                > For me, the Wizard pops up in any case -- even with curly braces.
                >
                > Could there be something wrong with an If that is followed by a Wizard on the same line? At first glance, this should comply with the syntax (since NT v4.8).


                I think this has something to do with the way NoteTab parses lines, from the RIGHT. Which means it parses the wizard before it parses the test.


                This problem has existed all along (at least back to NTP 4.9).

                The solution is to make the test a two-liner.

                ^!If ^%test% SKIP
                ^!Set %varname%=^?{wizard}



                Cheers,



                Eb
              Your message has been successfully submitted and would be delivered to recipients shortly.