Re: NTP Does Not Stay in Focus
- --- In firstname.lastname@example.org, "nullclip" <nullclip@...> wrote:
>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.)
> 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?
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
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.
>Mastering Regular Expressions (book by Jeffrey Friedl) http://regex.info/
> 2. Can you recommend a good reference/tutorial (book or URL) for regex commands?
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
>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.
> 3. Do Keyboard commands work on other focused apps? Some, all, few, none?
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.
>If you launch an app in the clip, you need ^!IfAppOpen in a loop to ensure it has happened.
> 4. Is there a command line parameter that will force the focus on the opening app, or must I use ^!FocusApp AppTitle?
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.