 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
arbe
Joined: 12 Apr 2005 Posts: 30
|
Posted: Wed May 10, 2006 6:53 pm Post subject: Input command interrupted by hotkeys |
|
|
The Input command is currently interruptable by hotkeys:
| Quote: | | While an Input is in progress, new threads such as custom menu items and timed subroutines can still be created. Similarly, keyboard hotkeys are still in effect if the Input is visible. If the Input is not visible, only hook hotkeys can be triggered. |
Still, in an example provided in the help, Chris sees the benefit of having a way to wait for the next user input by providing this code snippet:
| Quote: | ; Wait for the user to press any key. Keys that produce no visible character,
; such as the modifier keys, function keys, and arrow keys, are listed as end keys
; so that they will be detected too.
Input, SingleKey, L1, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}
{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}{Pause} |
Unfortunately, it does not work in the intended way when there are hotkeys activated. Chris, would you be able to add another parameter that interrupts the input command no matter if a hotkey was pressed?
The syntax could be:
Input [, OutputVar, Options, EndKeys, MatchList, HotkeysInterrupt]
with HotkeysInterrupt being a binary variable.
This option would be very helpful to let the user indicate when certain tasks in the target application finish. For example, once in a while I have a problem with this use case:
| Code: | #v:
backup:=clipboard
clipboard=test
send ^v
sleep 500
clipboard:=backup
return |
Sometimes, the target application is too slow to fetch the clipboard contents before they are restored after half a second. Extending the sleep interval is not a good idea since the user does not want to wait for the original clipboard contents for too long.
(The above is a simple example. Using the send command instead of clipboard pasting is not sufficient in some use cases.)
The suggested modification to the input command would allow an AHK programmer to let the user indicate that the target application has processed the ^v pasting. If he triggers #v he will typically not press any further keys until the last command (pasting "test") has finished. When he does press the next key, the original clipboard content should be restored since the next key sequence might be a regular ^v or another hotkey that uses the clipboard. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Wed May 10, 2006 8:20 pm Post subject: |
|
|
As it stands now, the benefits don't seem substantial enough or (I don't understand them well enough) to commit adding such a feature. However, there is already a plan to add an OnKeystroke feature that would allow the script to receive all key presses so that it can decide what the user really intends. When implemented, perhaps it will be suitable for this task too.
Until then, maybe there is some other way to achieve the goal. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|