AutoHotkey Community

It is currently May 27th, 2012, 11:29 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: July 13th, 2004, 10:00 pm 
Offline

Joined: July 13th, 2004, 8:25 pm
Posts: 10
Hi,

Just installed AutoHotkey a few days ago and like it a lot. Thanks Chris! 8)

There are several questions that I haven't been able to find an answer to.

Perhaps someone here or Chris can help?

I've written two scripts so far:

1) GUI interface for SC.EXE to install an executable as a service

2) Hotkey-Mapping script for my Desktop Icons as Win2K's icon "Shortcut Keys" often do not work reliably. I'm launching the shortcuts and not the executables because that way I can control some things from the Icon Properties box and I like to have these icons on my Desktop anyway and have them work the same way whether I hotkey them or double-click them.

The code for both is included after the questions.

------------------------------------------------------------------

1) Passing Double-Quotes to Programs

This may be more of a Windows problem than AutoHotkey, but I've had a devil of a time passing quotation marks (standard double-quote) to windows programs, particularly 16 bit programs that run in the command prompt window. Seems windows strips them all out. The cmd /c option works if the passed argument is an executable and the command is part of the native cmd environment, otherwise not.

I found this in the case of my script for the "Run As a Service" GUI. When I passed the path to the executable for the service enclosed in double-quotes (because the path contains spaces) to instsrv.exe or sc .exe (MS Resource Kit Utils to Add Services), the quotes would invariable get stripped out leaving a registry entry without the quotes and which would not run.

I tried using two-double-quotes, single-quotes around double-quotes, and all failed. Even using the command shell with cmd /c failed to resolve this.

So my GUI only handles service names and paths to executables with no spaces in them, which works cause most should reside in \winnt\syustem32 or the equivalent anyway.

As the AutoHotkey compiler does not treat quotes as special characters, I'm assuming that this isn't really a problem with the scripting language, but any ideas would certainly help!

Any Ideas?


2) Run <> Windows Run for Special Shortcuts

The AutoHotkey "Run" command does not seem to be exactly equivalent to the Windows Run box in at least this way:

MS Office-creates special "Windows Installer" shortcuts which are the preferred method of running Excel, Word, Outlook, etc. The problem is that these are not standard shortcuts but actually calls to a Microsoft component. See: http://support.microsoft.com/default.as ... -us;243630

I can put the \path\shortcut.lnk to these special shortcuts into the Start Menu/Run box or a Command box (which I eventually did in my script) and they launch the program without problem.

The AutoHotkey "Run" command, however, will not launch them. I think I tried RunWait also, but not sure.

Any Ideas?


3) Running a Compiled Script as a Service

After I was able to successfully install my compiled hotkeys script as a service, I was still not able to get it to run from the "Services" MMC or on Reboot. It comes back with a timeout message that the service did not respond.

Any ideas?


4) No String Manipulation Commands?
In an effort to fix the double-quotes problem mentioned earlier, I searched for commands, either in AutoHotkey or the Windows cmd environment to operate on strings so that I could add the double-quotes inside the variables I was passing, instead of on the outside. Something like "Concatenate(X,Y,Z...)" etc.. But while I found logical operators for strings, I could not find any for text manipulation.

Any Ideas?


5) No Variable "Assignment" Operator?

In searching for String Commands I was also not able to find any kind of "Variable Assignment" operator such as: Service_Name := "Hotkeys" where := loads the string “Hotkeys” into the variable Service_Name

Any Ideas?


6) Hotkeys "Sticking"

Biggest problem with my current hotkeys script is that, at times, the modifiers for my Hotkeys seem to "stick" in that after I run one of my hotkeys, specifically the one that is “<Left Ctrl><Left Alt>-“ which launches a Saved Search, the <Ctrl> and <Alt> buttons seems to "stick" in that as I next type letters into the search box, all of my Hotkeys that correspond to those letters begin to launch, as if I still had the <Ctrl> and <Alt> keys held down.

If I close the original Hotkey that caused the problem I run it again later, the problem does not recur.

BTW that's a "minus sign" as the hotkey that's modified above and, I did check to make sure that Windows Accessibility "Sticky Keys" weren’t enabled. :wink:

Any Ideas?

------------------------------------------------------------------

HERE ARE THE TWO SCRIPTS REFERRED TO:ABOVE:

1) HOTKEYS.AHK

;Hotkeys Mapping of Desktop Icons

<^<!-::Run, "C:\Documents and Settings\user\Desktop\Find Favorites.lnk"
<^<!.::Run, "C:\Documents and Settings\user\Desktop\Show Desktop.lnk"
<^<!/::Run, "C:\Documents and Settings\user\Desktop\Programs.lnk"
<^<!c::Run, "C:\Documents and Settings\user\Desktop\Close All Open Windows.lnk"
<^<!d::Run, "C:\Documents and Settings\user\Desktop\Downloads.lnk"
<^<!e::Run, cmd /c "C:\Documents and Settings\user\Desktop\Microsoft Excel.lnk", , Hide
<^<!f::Run, "C:\Documents and Settings\user\Desktop\Find Documents.lnk"
<^<!g::Run, "C:\Documents and Settings\user\Desktop\Genealogy Files.lnk"
<^<!i::Run, "C:\Documents and Settings\user\Desktop\Internet Explorer.lnk"
<^<!l::Run, "C:\Documents and Settings\user\Desktop\Legacy 4.0.lnk"
<^<!m::Run, "C:\Documents and Settings\user\Desktop\My Documents.lnk"
<^<!n::Run, "C:\Documents and Settings\user\Desktop\New Project.lnk"
<^<!o::Run, cmd /c "C:\Documents and Settings\user\Desktop\Microsoft Outlook.lnk", , Hide
<^<!p::Run, "C:\Documents and Settings\user\Desktop\Psion Manager.lnk"
<^<!q::Run, "C:\Documents and Settings\user\Desktop\Quicken 2004.lnk"
<^<!s::Run, "C:\Documents and Settings\user\Desktop\Find Downloads.lnk"
<^<!v::Run, "C:\Documents and Settings\user\Desktop\Favorites.lnk"
<^<!w::Run, cmd /c "C:\Documents and Settings\user\Desktop\Microsoft Word.lnk", , Hide


2) RUN AS A SERVICE.AHK

;Install an Executable as a Service.

;This Script Requires the Windows Resource Kit utility SC.EXE to be in your path, preferably the C:\winnt\system32 directory or equivalent.

MsgBox, 1, , This Utility Does Not Support Installing Service Names or Paths with Spaces in Them. Do You Want to Continue?
IfMsgBox, Cancel, Exit
InputBox, Service_Name, , Please Enter The Service Name
If ErrorLevel=1, Exit
FileSelectFile, Service_Executable, , C:\WINNT\System32, Please Select The Service Executable, *.exe
If ErrorLevel=1, Exit
Run, SC create %Service_Name% type= interact Start= Auto binpath= %Service_Executable% DisplayName= %Service_Name%


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 13th, 2004, 11:32 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Quote:
I've had a devil of a time passing quotation marks (standard double-quote) to windows programs, particularly 16 bit programs that run in the command prompt window. Seems windows strips them all out. The cmd /c option works if the passed argument is an executable and the command is part of the native cmd environment, otherwise not.

If you haven't tried already, try running the program directly (don't use cmd /c). If that doesn't work, you could also try running the app's short name, wherein a folder such as "Program Files" is usually expressed as "progra~1". Someone with more knowledge of 16-bit behaviors might be able to give more detail.

Quote:
When I passed the path to the executable for the service enclosed in double-quotes (because the path contains spaces) to instsrv.exe or sc .exe (MS Resource Kit Utils to Add Services), the quotes would invariable get stripped out leaving a registry entry without the quotes and which would not run.

I don't know for sure if this will help, but if instsrv.exe and sc .exe are anything like regedit, maybe you have to escape the quotes using backslash? e.g. "\"mystring.exe\" param1 \"param with spaces\"". This might be completely off target since I'm pretty unfamiliar with this area.

Quote:
As the AutoHotkey compiler does not treat quotes as special characters, I'm assuming that this isn't really a problem with the scripting language

AHK makes some attempt to figure out double quotes when used with Run/RunWait. IIRC, this is because CreateProcess() gets messed up if double quotes are present when they shouldn't be. However, if CreateProcess() fails, AHK falls back to ShellExecute(), which is more lenient. It's possible there is a bug in here, so if you get an error dialog when running something you think should run, maybe you can press control-c on it and send me the contents. You could also send me a specific Run/RunWait command line that you believe should work but doesn't. With your help, I would like to resolve this if possible.

Quote:
The AutoHotkey "Run" command, however, will not launch them. I think I tried RunWait also, but not sure.

Thanks to you, I found out that support for running .lnk files (shortcuts) appears to be completely broken. I'm not sure when this happened, but I've fixed it. Maybe you can re-download and let me know if the problem is corrected.

Quote:
After I was able to successfully install my compiled hotkeys script as a service, I was still not able to get it to run from the "Services" MMC or on Reboot. It comes back with a timeout message that the service did not respond.

Well, it's not designed to run as a service, but I've heard at least one person say that it works, at least for some things. Perhaps you have to grant permission to the service to "have access to the desktop" and other such things. It probably depends on what the script does. Hopefully, someone more knowledgeable will step in and say something.

Quote:
Something like "Concatenate(X,Y,Z...)" etc..

Concatenate is intrinsic. For example:
var1 = This will be prepended.%var1%And this will be appended.

Quote:
I was also not able to find any kind of "Variable Assignment" operator such as: Service_Name := "Hotkeys" where := loads the string “Hotkeys” into the variable Service_Name

Just use:
var = string

This should probably be covered in the tutorial, so thanks for pointing it out.

Quote:
6) Hotkeys "Sticking" ... specifically the one that is “<Left Ctrl><Left Alt>-“

Does it happen almost exclusively with that one hotkey? Do you get a bit of keyboard or mouse lag when launching this hotkey? I'd like to work with you to get this fixed.

Quote:
If I close the original Hotkey that caused the problem I run it again later, the problem does not recur.

Yes, I think that could be due to "caching". Are you saying that when it launches quickly, the problem does not occur, and then when it launches slowly, it tends to happen?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2004, 6:34 am 
Offline

Joined: July 14th, 2004, 6:21 am
Posts: 20
Just installed this tonight and thanks a ton. I've been looking for something like this.

Maybe I could add some additional information about the hotkeys sticking. I created a script for a cannon firing and then move to another position to watch from a better perspective. Once I was finished I release the fire key and return to the original position.

Here is some code that works:
Quote:
2Joy1::
SetKeyDelay, 30
send, {f down}
send, {f up}

send, {2 down}
send, {2 up}

send, {NumpadDot down}
send, {NumpadDot up}

send, {NumpadDot down}
send, {NumpadDot up}

Loop
{
Sleep, 10
GetKeyState, state, 2Joy1, P
if state = U ; The key has been released, so break out of the loop.
break
}

send, {3 down}
send, {3 up}

send, {NumpadDot down}
send, {NumpadDot up}

send, {NumpadDot down}
send, {NumpadDot up}

return


and here is the top section of the version that didn't work where the joystick hotkey was passed through to the application instead of being remapped. The "f" key is now commented out and the rest of the code is the same as above.

Quote:
~2Joy1::
SetKeyDelay, 30
;send, {f down}
;send, {f up}


When I originally tried it with the hotkey being passed through and acted on by the game it would remain stuck down (the cannon would continuously fire) even though it passed through the section of the code that detected that the hotkey had been released.

I was suspecting that I was doing something wrong since this was my first attempt, but maybe that can shed some light on the issue.

-- Additional question --

I'm not sure why it seemed that I needed to type

send, {2 down}
send, {2 up}

instead of simply saying

send, 2

when I did that the "2" key would apparently never reach the game.

_________________
SJKeegs


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2004, 12:10 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Quote:
and here is the top section of the version that didn't work where the joystick hotkey was passed through to the application instead of being remapped...
~2Joy1::

In the fine print, the help file says "Note that hotkey prefix symbols such as ^ (control) and ~ (pass-through) are not supported [for joystick buttons]."

Quote:
I'm not sure why it seemed that I needed to type
send, {2 down}
send, {2 up}
instead of simply saying
send, 2

No delay is done in between the down and up events of a keystroke. But when the down and up events are sent separately, a delay (whose length is set by SetKeyDelay) will be in effect in between them. Perhaps the game is sensitive to this. If so, it's good info because I am unaware of any other games that refuse to accept keystrokes just because the up-event immediately follows the down-event. Is this game a relatively old one?

If anyone else has a game in which keystrokes are not accepted, it would be great to find out if the down+up technique solves it.

Btw, I think you can simplify slightly by combining the events on one line: send, {2 down}{2 up}

Quote:
When I originally tried it ... it would remain stuck down (the cannon would continuously fire) even though it passed through the section of the code that detected that the hotkey had been released.

Is this the issue that was fixed by converting each Send into a down-Send and an up-Send?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2004, 6:56 pm 
Offline

Joined: July 14th, 2004, 6:21 am
Posts: 20
Chris wrote:
In the fine print, the help file says "Note that hotkey prefix symbols such as ^ (control) and ~ (pass-through) are not supported [for joystick buttons]."

I missed that - I was testing AutoHotkey out to see if I could use it, and quickly scanned the docs enough to attempt to see how it works. I saw this thread and was seeing a similar problem and thought I might be able to help. I think my issue is something else entirely at this point though.

Here is my code as I revised it (with better comments)

Quote:
2Joy1:: ; fire main weapon
SetKeyDelay, 30

send, {2 down}{2 up} ; Move to Commander Position
send, {NumpadDot down}{NumpadDot up} ; Zoom in twice
send, {NumpadDot down}{NumpadDot up}

Loop ; Wait for trigger to be released
{
Sleep, 10
GetKeyState, state, 2Joy1, P
if state = U ; The key has been released, so break out of the loop.
break
}

send, {3 down}{3 up} ; Go back to gunner position
send, {2Joy1 up} ; make sure we see the joystick keylift
send, {NumpadDot down}{NumpadDot up} ; Zoom in twice
send, {NumpadDot down}{NumpadDot up}

return


Quote:
If so, it's good info because I am unaware of any other games that refuse to accept keystrokes just because the up-event immediately follows the down-event. Is this game a relatively old one?

The game is WWII Online which is 3 years old at this point and is quite CPU intensive. Keymappings can mean different things when you move to different positions in a vehicle. I think what is happening is that the joystick button UP is eaten up when in the commander position where it could mean something completely different, and that it isn't seen from the gunner position and then acts as if it is stuck down.

I tried adding the "send, {2Joy1 up}" when back in the gunner position but the game didn't seem to recognize that additional keylift event. Did I miss something else in the docs?

In any case I don't think my Stuck key issue is the same as the first one, and I can do what I want if I simply use the hotkey as a trigger and map the weapon firing to another key.

Quote:
Is this the issue that was fixed by converting each Send into a down-Send and an up-Send?

No. converting each "send" into a "send-down-up" only enabled the game to see the keypresses. As I noted above I think the joystick key release was being eaten up while in another position in the vehicle, and probably discarded since it doesn't mean anything in that position.

Thanks for the help - Great program.

_________________
SJKeegs


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2004, 7:21 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Quote:
send, {2Joy1 up} ; make sure we see the joystick keylift

The above won't work because AHK can't simulate joystick button presses or anything else joystick related. All it can do is read the state of the joystick buttons and axes, and make buttons into hotkeys. Therefore, it is best to "unmap" in the game any joystick buttons you want to use as hotkeys, and then use AHK to remap those buttons to send keystrokes or whatever else you need them to do. Otherwise, the game will see both the joystick button presses and the keystrokes produced by the script.

In the following thread, BaldieJr talks about one of his projects. I believe he uses a special joystick driver in conjuction with AHK to simulate joystick activity. You might want to ask him about it:

http://www.autohotkey.com/forum/viewtopic.php?t=469


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2004, 7:13 pm 
Offline

Joined: July 13th, 2004, 8:25 pm
Posts: 10
Hi Chris,

Thanks for your help with this!

Quote:
I've had a devil of a time passing quotation marks (standard double-quote) to windows programs, particularly 16 bit programs that run in the command prompt window. Seems windows strips them all out. The cmd /c option works if the passed argument is an executable and the command is part of the native cmd environment, otherwise not.

Chris wrote:
If you haven't tried already, try running the program directly (don't use cmd /c). If that doesn't work, you could also try running the app's short name, wherein a folder such as "Program Files" is usually expressed as "progra~1". Someone with more knowledge of 16-bit behaviors might be able to give more detail.


Good suggestions.

I actually tried using cmd with options as a way to *fix* the problem. I was originally running it directly with the scripted Run command and that didn’t work, so I experimented with running cmd and passing the program as a parameter.

Since these are 16 bit programs that open a command prompt window when executed anyway, I figured that there was no way getting around cmd regardless.

Yes, short filenames would solve the problem. Just need to find a way to modify the variable after it is entered in the FileSelectFile message box..... ;-)
..........

Quote:
When I passed the path to the executable for the service enclosed in double-quotes (because the path contains spaces) to instsrv.exe or sc .exe (MS Resource Kit Utils to Add Services), the quotes would invariable get stripped out leaving a registry entry without the quotes and which would not run.

Chris wrote:
I don't know for sure if this will help, but if instsrv.exe and sc.exe are anything like regedit, maybe you have to escape the quotes using backslash? e.g. ""mystring.exe" param1 "param with spaces"". This might be completely off target since I'm pretty unfamiliar with this area.


Good ideas!! I tried them all but, unfortunately, didn’t have much luck :-(

Quote:
As the AutoHotkey compiler does not treat quotes as special characters, I'm assuming that this isn't really a problem with the scripting language

Chris wrote:
AHK makes some attempt to figure out double quotes when used with Run/RunWait. IIRC, this is because CreateProcess() gets messed up if double quotes are present when they shouldn't be. However, if CreateProcess() fails, AHK falls back to ShellExecute(), which is more lenient. It's possible there is a bug in here, so if you get an error dialog when running something you think should run, maybe you can press control-c on it and send me the contents. You could also send me a specific Run/RunWait command line that you believe should work but doesn't. With your help, I would like to resolve this if possible.


I’ll help any way I can, though I’m not getting any error dialogs - likely because I didn’t code any error traps in. :-)

Quote:

The AutoHotkey "Run" command, however, will not launch them. I think I tried RunWait also, but not sure.

Chris wrote:
Thanks to you, I found out that support for running .lnk files (shortcuts) appears to be completely broken. I'm not sure when this happened, but I've fixed it. Maybe you can re-download and let me know if the problem is corrected.


Will do, thanks! But shortcuts weren’t completely broken - they all worked except the Office ones. I’ve downloaded the latest version too - much obliged!

Quote:
After I was able to successfully install my compiled hotkeys script as a service, I was still not able to get it to run from the "Services" MMC or on Reboot. It comes back with a timeout message that the service did not respond.

Chris wrote:
Well, it's not designed to run as a service, but I've heard at least one person say that it works, at least for some things. Perhaps you have to grant permission to the service to "have access to the desktop" and other such things. It probably depends on what the script does. Hopefully, someone more knowledgeable will step in and say something.


Good idea - I will take a look at the User Rights and Security policies to see if this plays a part. I forgot that the script as a service is not running under the context of Administrator as I am when I run it manually, and I’ve pretty well tweaked down all the User Rights so only the System and I have access.

Quote:
Something like "Concatenate(X,Y,Z...)" etc..

Chris wrote:
Concatenate is intrinsic. For example:
var1 = This will be prepended.%var1%And this will be appended.


Fantastic!

Quote:
I was also not able to find any kind of "Variable Assignment" operator such as: Service_Name := "Hotkeys" where := loads the string “Hotkeys” into the variable Service_Name

Chris wrote:
Just use:
var = string

This should probably be covered in the tutorial, so thanks for pointing it out.


Thank YOU for making this scripting language so accessible. I probably should have just tried that to see if it worked. ;-)

Quote:
6) Hotkeys "Sticking" ... specifically the one that is “<Left Ctrl><Left Alt>-“

Chris wrote:
Does it happen almost exclusively with that one hotkey? Do you get a bit of keyboard or mouse lag when launching this hotkey? I'd like to work with you to get this fixed.


Quote:
If I close the original Hotkey that caused the problem I run it again later, the problem does not recur.

Chris wrote:
Yes, I think that could be due to "caching". Are you saying that when it launches quickly, the problem does not occur, and then when it launches slowly, it tends to happen?


Okay, I figured out what was causing the “sticking” phenomenon. At first I thought it was a conflict with another key remapper that came with my ThinkPad to control special keyboard keys like volume and such, and which I have also used to reassign the right <Alt> key to be the <Windows> key.

After experimenting, however, I realized it is actually Zone Alarm that is causing the problem. For some reason, Zone Alarm doesn’t like key-remapping programs, as it alerts on both the ThinkPad and AutoHotkey apps as trying to access the Internet, but it is reported bizarrely. For The ThinkPad remapper, it lists the program as trying to access the internet, but does not say whether it is an outgoing or incoming request, and specifies neither source nor destination addresses.

For AutoHotkey, it lists no source address but *does* say it is an outgoing request, and, strangely, lists the destination IP as 0.0.0.0:80 (http).

The reason this was a problem for my Hotkeys script is that every time I recompiled it (quite often during testing), Zone Alarm detected it as a new program, and popped up a dialog box asking me to allow or deny the first time I ran it. Somehow, that dialog box immediately popping up interrupts the script in such a way that the <Ctrl>l and <Alt> keys stay stuck down until I hit them a few times individually. I guess this makes sense - it’s Zone Alarm’s job to block any possibly destructive process, and I guess in this case that means suspending the script at a critical point in it’s execution. Either that or the process that AutoHotkey calls to intercept the keystrokes is waiting on Zone Alarm and times out?

In any case, the fix was simple - stop making changes to the script and register the final version with Zone Alarm so there is no popup and all is well :-) I also forced usage of the Keyboard Hook, which seems to make everything more stable.

Now if I can just figure out why Zone Alarm thinks key remappers are trying to access the Internet...

Thanks also to SJKeegs for the idea about the separated key_up and key_down commands. Sending the modifiers as separate explicit commands, and introducing the time delay as Chris pointed out, may have just worked had I not gotten Zone Alarm to behave.

Kindest Regards,

ealerner


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2004, 11:21 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Quote:
Yes, short filenames would solve the problem. Just need to find a way to modify the variable after it is entered in the FileSelectFile message box.....

The following trick might work:
Use SetWorkingDir to get into the right directory (or just pass the correctly long-filename dir as the 2nd param of Run/RunWait if that's all you need). Use a file-loop to discover the shortname of the file (which won't include it's path):
Code:
Loop, My Long Filename.txt
     short_filename = %A_LoopFileShortName%

Now you have the short name, but not the short path. But since you'll be running in the right working dir, hopefully you won't need the short path.

Quote:
I’ll help any way I can, though I’m not getting any error dialogs

Strange because Run/RunWait should usually display an error dialog if it's unable to launch something.

Quote:
But shortcuts weren’t completely broken - they all worked except the Office ones

For some reason I couldn't get any to run on my system until I made that change I mentioned.

Quote:
grant permission to the service to "have access to the desktop"

I think the above setting is in a fairly prominent place within the Services applet, perhaps in properties or something.

Quote:
I also forced usage of the Keyboard Hook, which seems to make everything more stable.

The keyboard hook is especially helpful for hotkeys that use the Send command, since detection of what keys the user is holding down (or releasing) is much more certain.

Quote:
After experimenting, however, I realized it is actually Zone Alarm that is causing the problem.

Thanks for following up on that.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Hotkeys still "Sticking"
PostPosted: July 23rd, 2004, 6:30 pm 
Offline

Joined: July 13th, 2004, 8:25 pm
Posts: 10
Hi Chris,

I thought that Zone Alarm was the issue with the hotkeys sticking down on my system, and perhaps it still is, but I've allowed access for AutoHotkey (no ZA dialog box popping up anymore) but still have problems often with other programs seeming to intercept my hotkey script & hence leaving my <Ctrl> & <Alt> Hotkey-Mapped buttons down, and making everything I type start running programs and opening windows.

Somehow, I think I need the hotkeys to be seen before any other program, ZA included.

Chris, I wonder if you've seen the source code at sysinternals that discusses hooking directly into the keyboard driver to provide the most keyboard filtering stability? It's at:

http://www.sysinternals.com/ntw2k/source/ctrl2cap.shtml

Kindest Regards


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2004, 11:01 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Generally, keys should not stick. In the past, there have been exceptions such as the Ctrl-Alt-Del security screen, which I have fixed wherever possible. If you have chronic sticking keys, I would very much like to work with you to reproduce this on my system so that it can be resolved (I use many hook hotkeys on my XP system and they seem very non-stick and reliable).

Maybe it's just interference from other software, as you mentioned. But if so, I'm really wondering what that other software is doing that would interfere with AHK's low-level hook. To interfere, that software would either have to use a low-level hook of its own, or be doing something at the driver level.

Anyway, most hotkeys -- and thus by extension most scripts -- do not use the hooks. The hooks are only there to support advanced hotkeys and mouse hotkeys (and recently, hotstrings). The caplock example you mentioned is a "kernel-mode device driver" and thus quite a bit lower level and riskier to system stability/compatibility than a keyboard hook. I admit I haven't researched it, but the odds are that even if I wanted to adapt it, it would involve a major rewrite. Even so, I've made a note to look into it down the road, so thanks.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group