 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
guest Guest
|
Posted: Thu Jan 06, 2005 1:29 pm Post subject: ControlSend sends CTRL,ALT keystroke to all apps |
|
|
Just had another problem with autohotkey. Heres a small example of my macro:
| Code: |
; IMPORTANT, macro doesn't work if this line is omited
SetKeyDelay 200,80
app_id = -1
MsgBox, Los gehts
; just to get the id of the window
SHIFT & 1::
WinGet, app_id, ID, A
MsgBox, ID is %app_id%
Return
; The Macro
SHIFT & 2::
; Testen ob ID schon gesetzt wurde
if app_id = -1
{
MsgBox, Pls press SHIFT+1 in the macro window
}
; have to have a sleep before my macro, if not the first few keystrokes are missing
Sleep 2000
Loop
{
Gosub getHealth
}
Return
; --- Proceduren ------
; Recycle Time: 6
; Cast Time 3
GetStamina:
ControlSend, , {END}!1, ahk_id %app_id%
Sleep 4000
Return
|
The macro runes more or less fine. The big key delay is a mess but i think thats because of the game i use the macro for. The Problem comes if i switch to firebird or any other app.
The CTRL, ALT keys are send to this app also. Im not sure if they are send also to the app with the app_id but its pretty anoying to work when a CTRL key is pressed every 4 secs.
This is only for the CTRL,ALT keys, all other key strokes are send to the right app. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Thu Jan 06, 2005 2:34 pm Post subject: |
|
|
Am Dienstag Dez 29, 2004 9:09 noch keiner gewesen und zwischenzeitlich zu guest "the Guest" aufgestiegen.
Das ist doch mal cool.
 |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jan 06, 2005 6:17 pm Post subject: |
|
|
aber die probleme sind geblieben  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Thu Jan 06, 2005 8:07 pm Post subject: |
|
|
| Quote: | The Problem comes if i switch to firebird or any other app.
The CTRL, ALT keys are send to this app also. | There's a little note buried in the help file for ControlSend:
In v1.0.21+, this can be avoided by explicitly sending modifier up and down events as in this example:
ControlSend, Edit1, {Alt down}f{Alt up}, Untitled - Notepad
This alternate method of sending CTRL/ALT/SHIFT might not work for all apps, but it's worth a try. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jan 19, 2005 8:59 am Post subject: |
|
|
| i tried to use CTRL_DOWN/CTRL_UP but again no luck. The type latency in other programms while running the macro seems to be a little bit better but still CTRL and ALT keys are also send to the application in the foreground also |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Thu Jan 20, 2005 1:08 am Post subject: |
|
|
Yes, I see what you mean. I tried the following test script: | Code: | SetKeyDelay, 10, 10
Run, Notepad
WinWait, Untitled - Notepad
WinActivate
ControlSend,, Test`tTest`tTest`tTest`tTest`tTest`tTest`tTest`tTest`tTest
Loop, 1000
{
ControlSend,, {End}{Control down}{Shift down}{left}{shift up}{Control up}
} |
Although the interference is reduced, it still prevents you from using the modifier keys in the active window (though you can type normally except for capital letters). I've yet to find a way to send modifier keystrokes to a window in the background without causing interference in the foreground window. If it's important, you could experiment with PostMessage yourself. There is info on the forum and in the help file about sending keystrokes via PostMessage. |
|
| 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
|