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

Using Menu and Keyboard

Expand Messages
  • John Mitchell
    Hello Some recent discussions on this board have spurred my interest in these two commands. Naively, I expected... ^!MENU File/Template/Open ^!Keyboard
    Message 1 of 7 , Jan 4, 2005
      Hello

      Some recent discussions on this board have spurred my interest in these
      two commands. Naively, I expected...

      ^!MENU File/Template/Open
      ^!Keyboard #html.tpl# Enter

      To open a new document using the HTML template. Unfotunately, only the
      MENU piece appears to work. No text is entered at the cursor and no
      ENTER is simulated. I tried the same thing with a keyboard delay before
      the #html.tpl# but it made no difference. What am I doing wrong?

      Regards, John M
    • loro
      ... I haven t followed this and I can t say I ve used these commands much but I *think* you want this: ^!Keyboard CTRL+O #^$GetTemplatePath$html.tpl# ENTER
      Message 2 of 7 , Jan 4, 2005
        John Mitchell wrote:
        >Some recent discussions on this board have spurred my interest in these
        >two commands. Naively, I expected...
        >
        >^!MENU File/Template/Open
        >^!Keyboard #html.tpl# Enter
        >
        >To open a new document using the HTML template. Unfotunately, only the
        >MENU piece appears to work. No text is entered at the cursor and no
        >ENTER is simulated. I tried the same thing with a keyboard delay before
        >the #html.tpl# but it made no difference. What am I doing wrong?

        I haven't followed this and I can't say I've used these commands much but I
        *think* you want this:

        ^!Keyboard CTRL+O #^$GetTemplatePath$html.tpl# ENTER

        Lotta
      • John Mitchell
        Lotta Yes, that works. Thanks. My question is really a more general one and is probably the result of misunderstanding ^!Keyboard. My ^!MENU File/Template/Open
        Message 3 of 7 , Jan 4, 2005
          Lotta

          Yes, that works. Thanks. My question is really a more general one and is
          probably the result of misunderstanding ^!Keyboard.

          My ^!MENU File/Template/Open command opens a dialog window that has
          focus, so I expected ^!Keyboard data to populate the dialog at the
          cursor. Instead, the text is entered into the Notetab document that was
          active when I double clicked the Clip name.

          Is there a way to do what I want (in general terms) using NTB to
          interact with dialogs and forms?

          Regards, John M

          ----- Original message -----
          From: "loro" <loro-spam01-@...>
          To: ntb-clips@yahoogroups.com
          Date: Wed, 05 Jan 2005 07:38:33 +0100
          Subject: Re: [Clip] Using Menu and Keyboard


          John Mitchell wrote:
          >Some recent discussions on this board have spurred my interest in these
          >two commands. Naively, I expected...
          >
          >^!MENU File/Template/Open
          >^!Keyboard #html.tpl# Enter
          >
          >To open a new document using the HTML template. Unfotunately, only the
          >MENU piece appears to work. No text is entered at the cursor and no
          >ENTER is simulated. I tried the same thing with a keyboard delay before
          >the #html.tpl# but it made no difference. What am I doing wrong?

          I haven't followed this and I can't say I've used these commands much
          but I
          *think* you want this:

          ^!Keyboard CTRL+O #^$GetTemplatePath$html.tpl# ENTER

          Lotta




          Yahoo! Groups Links
        • Pete Turner
          G day John, If you are using NoteTab to control other applications, which is mainly what ^!Keyboard is intended for, you need to ensure that the target
          Message 4 of 7 , Jan 5, 2005
            G'day John,

            If you are using NoteTab to control other applications, which is mainly
            what ^!Keyboard is intended for, you need to ensure that the target
            application has the focus before you issue the ^!Keyboard command.
            This is done using ^!FocusApp.

            In the example below, which is a real live example in my situation,
            ^!FocusApp is used to focus on the SQL Query Analyzer application window
            (the * is a wildcard to ensure that the command will still work if the
            application's window title bar contains something like SQL_Query
            Analyzer - [pw1.DMS.Admin - C:\Projects\Scripts\Core.sql]).

            The first pair of ^!Keyboard commands opens a login dialog and enters a
            user id and password; then the second pair opens a file dialog and
            enters the name of a script file - exactly the kind of thing you are
            trying to do.

            ^!FocusApp SQL Query Analyzer*

            ^!Keyboard &200 CTRL+O
            ^!Keyboard &600 SHIFT+TAB #^%SQLUser%# TAB #^%SQLPassword%# TAB TAB TAB
            TAB #^%SQLServer%# ENTER

            ^!Keyboard &800 ALT+F &200 #o#
            ^!Keyboard &400 #^%SQLScript%.sql# ENTER

            You may have to experiment, as I did, with keyboard delays (the &200,
            &600, etc., values in the above piece of code), depending on how long
            the target application takes to respond to a function key activated by
            ^!Keyboard.

            Also, if you use any other NoteTab clip command in the middle of a set
            of ^!Keyboard commands, you may need to repeat the ^!FocusApp command,
            as NoteTab may have reclaimed the focus. You can transfer the focus
            back to NoteTab explicitly using the ^!ActivateApp and/or ^!FocusDoc
            commands as appropriate.

            On the other hand, if you are trying to control NoteTab itself from
            within a clip, you are usually better off trying to avoid the use of
            ^!Keyboard, instead using the appropriate clip commands.

            Instead of

            ^!MENU File/Template/Open
            ^!Keyboard #html.tpl# Enter

            try the normal ^!Open command:-

            ^!Open "^$GetTemplatePath$html.tpl"

            As the first line of the file will contain the template header
            definition, NoteTab will recognise it as a template, and act
            accordingly. Of course, you won't get the Open Template dialog, but
            given that your templates will most likely be in NoteTab's Template
            directory, that shouldn't be too much of a problem. If you want to be
            able to select a template file, it wouldn't be too hard to get a list of
            the .tpl files in the Template directory and present them in a wizard,
            then substitute the name of the selected template file in the ^!Open
            command.

            Pete


            > -----Original Message-----
            > From: John Mitchell [mailto:notetab@...]
            > Sent: Wednesday, 5 January 2005 17:25
            > To: ntb-Clips List
            > Subject: Re: [Clip] Using Menu and Keyboard
            >
            >
            > Lotta
            >
            > Yes, that works. Thanks. My question is really a more general
            > one and is
            > probably the result of misunderstanding ^!Keyboard.
            >
            > My ^!MENU File/Template/Open command opens a dialog window that has
            > focus, so I expected ^!Keyboard data to populate the dialog at the
            > cursor. Instead, the text is entered into the Notetab
            > document that was
            > active when I double clicked the Clip name.
            >
            > Is there a way to do what I want (in general terms) using NTB to
            > interact with dialogs and forms?
            >
            > Regards, John M
            >
          • Jody
            Hi Pete, I hope I did not make this too confusing. It might be easier to just skip to the code and study it than to read what I wrote. It seems like I wrote a
            Message 5 of 7 , Jan 6, 2005
              Hi Pete,

              I hope I did not make this too confusing. It might be easier to
              just skip to the code and study it than to read what I wrote. It
              seems like I wrote a lot to explain a little. ;)

              There is a more accurate method of doing some of the things you
              are doing by looking for the Titlebar caption/title name. It does
              not always work, but most of the time it does and it takes the
              guesswork out for the amount of delay to be adding and depending
              on your machine at the particular time you run the Clip with the
              long delays can vary a lot. There's two examples below, although
              fairly similar.

              It's the ^!IfSame lines. Normally, the way I do it is to go about
              it manually first and see what the Titlebar is called.
              ^$GetAppTitle$ looks at the focused Titlebar and returns what it
              reads. So, you loop until the window is in focus known by the
              caption/title comparing (^!IfSame) it. Sometimes you can put the
              ^!IfSame in an ^!Info box so you can get a better look at it. I
              put something like the following where I expect the window to
              open. I can copy from the ^!Info box to prevent typos.

              ^!Info IfSame "^$GetAppTitle$" "NetCaptor User Center - Login - NetCaptor"

              When the ^!IfSame is the same you continue on with the Clip. The
              first ^!IfSame below looks for the full title. The second is
              looking at a part of the title, the last 17 characters to be
              exact.

              I find it easier to use StrCopyRight a lot of times in certain
              apps because the right side of the string is what is constant for
              the application name reading right to left. I just go back as
              many characters as need be to get the document name (in a lot of
              cases - the <title> tag in some browsers).

              It is easy in NoteTab to just select the characters and look at
              the Statusbar for the selection size - amount of characters and
              simply plug that figure in. StrCopy and StrCopyLeft require
              figuring out the index position, etc.

              ^!Set %Search4%=^$GetClipBoard$
              ^!Url http://xxx.xxx.xx.xxx/login.php
              ^!Delay 3
              ^!IfSame "^$GetAppTitle$" "NetCaptor User Center - Login - NetCaptor" Next else Skip_-1

              ^!ClipBoardSave
              ^!Delay 3
              ^!Keyboard Shift+Tab Tab Tab Tab
              ^!SetClipboard XXXXXXXXXXXXX
              ^!Keyboard Ctrl+V Tab
              ^!SetClipboard XXXXXXXXXXXXX
              ^!Keyboard Ctrl+V Tab Tab Enter
              ^!Delay 3
              ^!IfSame "^$StrCopyRight("^$GetAppTitle$";17)$" "Index - Netcaptor" Next else Skip_-1

              >^!FocusApp SQL Query Analyzer*
              >^!Keyboard &200 CTRL+O

              For instance, in your code, you are probably waiting for a
              certain dialog to open below from the Ctrl+O above. Instead of
              the &600 delay, you would use the ^!IfSame and ^$GetAppTitle$ in
              a loop like either of the following...

              ^!Delay 3
              ^!IfSame "^$GetAppTitle$" "The Full Titlebar Caption" Next else Skip_-1

              or

              ; reading from right to left
              ^!Delay 3
              ^!IfSame "^$StrCopyRight("^$GetAppTitle$";18)$" "Your Titlebar Name" Next else Skip_-1

              >^!Keyboard &600 SHIFT+TAB #^%SQLUser%# TAB #^%SQLPassword%# TAB TAB TAB TAB #^%SQLServer%# ENTER
              >
              >^!Keyboard &800 ALT+F &200 #o#
              >^!Keyboard &400 #^%SQLScript%.sql# ENTER
              >
              >You may have to experiment, as I did, with keyboard delays (the
              >&200, &600, etc., values in the above piece of code), depending
              >on how long the target application takes to respond to a function
              >key activated by ^!Keyboard.


              Happy Clip'n!
              Jody

              All Lists: http://www.fookes.us/maillist.htm
              Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
              UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
              Options: http://groups.yahoo.com/group/ntb-clips
              http://www.clean-funnies.com, http://www.sojourner.us/software
            • Pete Turner
              Hi Jody, ... No, there s no confusion here. That piece of code was written two or three years ago when I was a real green NoteTab newbie, but I ve never had
              Message 6 of 7 , Jan 6, 2005
                Hi Jody,

                > I hope I did not make this too confusing. It might be easier to
                > just skip to the code and study it than to read what I wrote. It
                > seems like I wrote a lot to explain a little. ;)

                No, there's no confusion here.

                That piece of code was written two or three years ago when I was a real
                green NoteTab newbie, but I've never had the time to revisit it (plus,
                it falls into the category of "if it ain't broke, don't fix it!!"). I
                don't think I'd found $^GetAppTitle$ at the time.

                > Normally, the way I do it is to go about it manually first
                > and see what the Titlebar is called.

                Yes, that's how I did it (and still do, for that matter).

                Usually ^!FocusApp is enough for me because most of the interactions I
                do are fairly simple.

                > For instance, in your code, you are probably waiting for a
                > certain dialog to open below from the Ctrl+O above.

                Yes, that's the case.

                > Instead of the &600 delay, you would use the ^!IfSame and
                > ^$GetAppTitle$ in a loop like either of the following...

                > ^!Delay 3
                > ^!IfSame "^$GetAppTitle$" "The Full Titlebar Caption" Next else
                Skip_-1

                As a programmer, the neatness of that appeals to me greatly. I might
                decide my code is "broke", after all :)

                One thing I've just learnt: I never knew you could use a negative
                number to Skip backwards (and looking just now, it doesn't seem to be
                mentioned in the help). I'll certainly be putting that to good use.


                Pete
              • Jody
                Hi Pete, ... If it works, don t fix it! Murphy s Law #nnn. :) I have a Library called SureWord that has 150 of Murph s laws along with Bible scripture
                Message 7 of 7 , Jan 11, 2005
                  Hi Pete,

                  >(plus, it falls into the category of "if it ain't broke, don't
                  >fix it!!").

                  "If it works, don't fix it!" Murphy's Law #nnn. :) I have a
                  Library called SureWord that has 150 of Murph's laws along with
                  Bible scripture popups. See below...

                  >Usually ^!FocusApp is enough for me because most of the interactions I
                  >do are fairly simple.

                  Very true, but machines change and then there's public domain Clip... ;)

                  >> ^!Delay 3
                  >> ^!IfSame "^$GetAppTitle$" "The Full Titlebar Caption" Next else Skip_-1
                  >
                  >As a programmer, the neatness of that appeals to me greatly. I
                  >might decide my code is "broke", after all :)

                  I didn't know you were a programmer. I wouldn't be talking to you
                  had I known. !_haha_!

                  >One thing I've just learnt:

                  Now, *that _is_* incredible! A programmer that can still learn! :-)

                  >I never knew you could use a negative number to Skip backwards
                  >(and looking just now, it doesn't seem to be mentioned in the
                  >help). I'll certainly be putting that to good use.

                  I love the Skip_[+|-]n, Skip_-n, Skip_+n, Skip_-1, Skip_+1
                  To me, they are the best thing since slice peach pie! :) Here's
                  some tips and cautions for the benefit of all of us...

                  Be sure to *know exactly* what the commands/functions *do*
                  before/after the Skip_-n. For instance, ^!Skip can trip you up.
                  :) From my ClipTut 5LA Lesson 5 above half way through there's a
                  sentence referring to the "Yes" in the ^!Skip dialog: "A Yes
                  answer *always* skips the next line unless it is a comment line.
                  [;Comment lines are not considered a line.] [However,] blank
                  lines are considered a line." So, you'll be counting your lines
                  and count the ;this line that is a comment a line and it will
                  set you Skip_-n off by one line.

                  Be careful to pay attention to what line(s) code you insert or
                  remove (especially at a later time), because it will shift the
                  lines making the Skip_[-|+]n change. Study the code above and
                  below a half dozen or so for at least a quick scan for Skip_-n.

                  I think it is best to keep the number of lines skipped minimal
                  because of the reasons above. It is much easier to see what is
                  going on in your Clip with a few lines skipped (or un-skipped 8D)
                  than with many. Personally, I don't go over 4 and then a lot of
                  time leave a blank line. For those that don't mind using ALL CAPS
                  in places SKIP_-N would be a good place. ;)

                  Also, remember that it might be a very long time past by when you
                  last used/edited the Clip. The ^!Goto command and Label may be
                  used and can be more descriptive helping you to remember what the
                  Clip does and is used for in the future.

                  NoteTabbers Assistant Snatch-A-Clip Page
                  http://www.notetab.net/html/snatchclp.htm

                  NoteTabbers Assistant Library Page
                  http://www.notetab.net/html/library.htm


                  I have 150 of "Murphy's Laws" in my SureWord Library. All the
                  popups can be brought up sequentially or randomly and at
                  specialized intervals. It was originally made for a scripture
                  memorization tool and broadened to topical like the rapture
                  (catching away of the saints) and can be used for other things
                  now. The following is the format that opens in an ^!Info box.

                  Murphy's Law # 1:
                  If rats are experimented on, they will develop cancer.

                  Murphy's Law # 5:
                  If there is an opinion, facts will be found to support it.

                  Murphy's Law # 8:
                  Law of Window Cleaning... It's on the other side.

                  Murphy's Law # 9:
                  Anything that happens enough times to irritate you, will happen
                  at least once more.

                  Murphy's Law # 10:
                  Nothing in the known universe travels faster than a bad check.

                  Murphy's Law # 22:
                  Nothing ever gets built on schedule or within budget.

                  Murphy's Law # 23:
                  While byrographic systems are typically encountered in substrata
                  of earthy or mineral matter in concreted state, discrete
                  substrata elements occasionally display a roughly spherical
                  configuration which, in presence of suitable gravitational and
                  other effects, lends itself to combined translatory and rotary
                  motion. One notices in such cases an absence of the otherwise
                  typical accretion of byrophyta; we can therefore conclude that A
                  rolling stone gathers no moss.

                  Murphy's Law # 65:
                  Interchangeable parts won't.

                  Murphy's Law # 64:
                  If a project requires n components, there will be n-1 components available.

                  Murphy's Law # 63:
                  Information necessitating a change in design will be conveyed to
                  the designer, after the plans are complete.

                  Murphy's Law # 66:
                  Components that must not and can not be assembled improperly will be.

                  Murphy's Law # 67:
                  The most delicate component will be dropped.

                  Murphy's Law # 68:
                  The construction and operation manual will be discarded with the
                  packing material. The garbage truck will have it picked up five
                  minutes before the mad dash to the rubbish can.

                  Murphy's Law # 69:
                  A component selected at random from a group having a 99%
                  reliability, will be a member of the 1% group.

                  Murphy's Law # 70:
                  After an instrument has been assembled, extra components will be
                  found on the bench.



                  Happy Clip'n!
                  Jody

                  All Lists: http://www.fookes.us/maillist.htm
                  Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
                  UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
                  Options: http://groups.yahoo.com/group/ntb-clips
                  http://www.clean-funnies.com, http://www.sojourner.us/software
                Your message has been successfully submitted and would be delivered to recipients shortly.