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

NTP Does Not Stay in Focus

Expand Messages
  • nullclip
    I am not sure if this is a bug or a feature. I wrote the following clip with the intent to open all URLs listed in an outline topic. (Is there a better way?)
    Message 1 of 4 , Oct 2, 2010
    • 0 Attachment
      I am not sure if this is a bug or a feature.

      I wrote the following clip with the intent to open all URLs listed in an outline topic. (Is there a better way?) It only opens the first URL found.

      ^!KeyboardDelay 100
      ^!Jump TEXT_START

      :Loop
      ^!Find "http" TIOS
      ^!IfError Terminate
      ^!Keyboard F9 ENTER
      ^!Jump SELECT_END
      ^!Goto Loop

      :Terminate
      ^!Goto EXIT

      The Keyboard F9 command does not work after focus is placed on the first URL opened in the browser window. I have a Windows 7 system.

      I tried replacing the Keyboard line with the following two lines.

      ^!Menu Tools/Open Link
      ^!Keyboard ENTER

      The lines open all the links one at a time, but requires me to click the OK button in the Open Link dialog box for each URL. (The Keyboard ENTER command does not do that for me. Why?)

      Despite these two attempts, I have still not found a way to automatically open all URLs on a page.

      Please help.
    • Sheri
      ... Might work if you added ^!Activateapp as the first command in your loop. ... Keyboard commands do not work on NoteTab s own dialogs because processing is
      Message 2 of 4 , Oct 2, 2010
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "nullclip" <nullclip@...> wrote:
        >
        > I am not sure if this is a bug or a feature.
        >
        > I wrote the following clip with the intent to open all URLs listed in an outline topic. (Is there a better way?) It only opens the first URL found.
        >
        > ^!KeyboardDelay 100
        > ^!Jump TEXT_START
        >
        > :Loop
        > ^!Find "http" TIOS
        > ^!IfError Terminate
        > ^!Keyboard F9 ENTER
        > ^!Jump SELECT_END
        > ^!Goto Loop
        >
        > :Terminate
        > ^!Goto EXIT
        >
        > The Keyboard F9 command does not work after focus is placed on the first URL opened in the browser window. I have a Windows 7 system.

        Might work if you added ^!Activateapp as the first command in your loop.

        >
        > I tried replacing the Keyboard line with the following two lines.
        >
        > ^!Menu Tools/Open Link
        > ^!Keyboard ENTER
        >
        > The lines open all the links one at a time, but requires me to click the OK button in the Open Link dialog box for each URL. (The Keyboard ENTER command does not do that for me. Why?)

        Keyboard commands do not work on NoteTab's own dialogs because processing is suspended while the dialog is open.

        >
        > Despite these two attempts, I have still not found a way to automatically open all URLs on a page.
        >
        > Please help.
        >

        See if this does what you want. Seems to work fine with Firefox.

        ^!SetArray %links%=^$GetDocMatchAll("https?://[^\x20\r\n<>]+";0)$
        ^!Set %i%=0
        :loop
        ^!Inc %i%
        ^!If ^%i%>^%links0% done
        ^!Url [Firefox] ^%links^%i%%
        ^!Goto loop
        :done
        ^!SetArray %links%=""
        ^!ClearVariable %links%
        ^!ClearVariable %i%
        ;end of clip

        Regards,
        Sheri
      • nullclip
        Sheri, Thank you for your effective solution. You were correct on both accounts. My clip works as intended work if I added ^!Activateapp as the first command
        Message 3 of 4 , Oct 3, 2010
        • 0 Attachment
          Sheri,

          Thank you for your effective solution. You were correct on both accounts. My clip works as intended work if I added ^!Activateapp as the first command in my loop. Your clip is more to the point.

          I have several questions regarding our clips below.

          1. Your statement, "Keyboard commands do not work on NoteTab's own dialogs because processing is suspended while the dialog is open" does not seem true, because my clip works using the Keyboard ENTER command with an open dialog box. Have I missed something?

          2. Can you recommend a good reference/tutorial (book or URL) for regex commands?

          3. Do Keyboard commands work on other focused apps? Some, all, few, none?

          4. Is there a command line parameter that will force the focus on the opening app, or must I use ^!FocusApp AppTitle?

          --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
          >
          > --- In ntb-clips@yahoogroups.com, "nullclip" <nullclip@> wrote:
          > >
          > > I am not sure if this is a bug or a feature.
          > >
          > > I wrote the following clip with the intent to open all URLs listed in an outline topic. (Is there a better way?) It only opens the first URL found.
          > >
          > > ^!KeyboardDelay 100
          > > ^!Jump TEXT_START
          > >
          > > :Loop
          > > ^!Find "http" TIOS
          > > ^!IfError Terminate
          > > ^!Keyboard F9 ENTER
          > > ^!Jump SELECT_END
          > > ^!Goto Loop
          > >
          > > :Terminate
          > > ^!Goto EXIT
          > >
          > > The Keyboard F9 command does not work after focus is placed on the first URL opened in the browser window. I have a Windows 7 system.
          >
          > Might work if you added ^!Activateapp as the first command in your loop.
          >
          > >
          > > I tried replacing the Keyboard line with the following two lines.
          > >
          > > ^!Menu Tools/Open Link
          > > ^!Keyboard ENTER
          > >
          > > The lines open all the links one at a time, but requires me to click the OK button in the Open Link dialog box for each URL. (The Keyboard ENTER command does not do that for me. Why?)
          >
          > Keyboard commands do not work on NoteTab's own dialogs because processing is suspended while the dialog is open.
          >
          > >
          > > Despite these two attempts, I have still not found a way to automatically open all URLs on a page.
          > >
          > > Please help.
          > >
          >
          > See if this does what you want. Seems to work fine with Firefox.
          >
          > ^!SetArray %links%=^$GetDocMatchAll("https?://[^\x20\r\n<>]+";0)$
          > ^!Set %i%=0
          > :loop
          > ^!Inc %i%
          > ^!If ^%i%>^%links0% done
          > ^!Url [Firefox] ^%links^%i%%
          > ^!Goto loop
          > :done
          > ^!SetArray %links%=""
          > ^!ClearVariable %links%
          > ^!ClearVariable %i%
          > ;end of clip
          >
          > Regards,
          > Sheri
          >
        • Sheri
          ... I don t think I can give you a satisfactory answer, except to say that since you combined the F9 and Enter keystrokes onto one Keyboard command, when
          Message 4 of 4 , Oct 3, 2010
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "nullclip" <nullclip@...> wrote:
            >
            > Sheri,
            >
            > Thank you for your effective solution. You were correct on both accounts. My clip works as intended work if I added ^!Activateapp as the first command in my loop. Your clip is more to the point.
            >
            > I have several questions regarding our clips below.
            >
            > 1. Your statement, "Keyboard commands do not work on NoteTab's own dialogs because processing is suspended while the dialog is open" does not seem true, because my clip works using the Keyboard ENTER command with an open dialog box. Have I missed something?

            I don't think I can give you a satisfactory answer, except to say that since you combined the F9 and Enter keystrokes onto one Keyboard command, when NoteTab happened to be active and in focus and in a state that it could process ^!keyboard commands on itself when it got the instruction, it worked. The clip interpreter will keep right on processing UNTIL the dialog is open (and it takes some number of split seconds before that happens.)

            You might try the following with and without the Delay to see what happens with the ^!Keyboard Hello command. You will not succeed in getting Hello typed into the Open Link dialog.

            ^!Find "http" TIOS
            ^!Keyboard F9
            ^!Delay 10
            ^!Keyboard #Hello#

            There are actually two types of dialogs. With most (like the Open Link one), NoteTab stops and waits, while with others (such as Find, and Find and Replace) the dialog behaves like another app. For those others you can focus the dialog based on its title, and send keystrokes to it.

            Any time you use Keyboard commands, you encounter timing and focus requirements which are not easily assured with clipcode. Some of the commands and functions that can sometimes bulletproof such clips are ^!IfAppOpen, ^!SetFocus, ^!FocusApp, ^!FocusDoc, ^$GetAppTitle$ and ^!ActivateApp.

            If NoteTab is the only app being automated by your clip, it is almost always possible and preferable to accomplish the task without Keyboard commands in your clip.

            >
            > 2. Can you recommend a good reference/tutorial (book or URL) for regex commands?

            Mastering Regular Expressions (book by Jeffrey Friedl) http://regex.info/
            Andrei's Regex Clinic (slides from a PHP presentation by Andrei Zmievski - 16MB free download -- might want to temporarily disable Acrobat plugin in your browser before using this link so it will download directly) http://gravitonic.com/c/dl.php?file=talks/php-quebec-2009/regex-clinic.pdf

            >
            > 3. Do Keyboard commands work on other focused apps? Some, all, few, none?

            Where a clip involves automation of other apps, sending keystrokes is usually the only way. NoteTab only distinguishes between windows based on their title. Sometimes this limitation is fine, other times its is a problem. With more sophisticated scripting environments (such as powerpro, autohotkey and autoit) you can access windows by other characteristics, such as window class or window text.

            The extent to which you can control other apps' windows in Vista and Windows 7 also depends on whether the user and NoteTab or another scripting environment is running with Admin privileges if UAC is enabled.

            >
            > 4. Is there a command line parameter that will force the focus on the opening app, or must I use ^!FocusApp AppTitle?

            If you launch an app in the clip, you need ^!IfAppOpen in a loop to ensure it has happened.

            To ensure focus you need not only use ^!FocusApp, you must do something like ^!IfSame ^$GetAppTitle$ "Name of appwindow" in a loop to ensure clip processing waits until focus has actually shifted.

            Have fun. :)

            FYI, my Clipcode Syntax clips (included with recent versions of NoteTab) and are useful during clip development.

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