1
votes

I have this AutoHotkey script that has a weird problem. It is used in 3 workstations, but in one the ControlSend doesn't seem to work as the hotkey doesn't work in program A. All three machines have Windows XP and are Pentium 4 level machines with mostly same software, the script is in exe form. I've tried a lot of different ways to send the hotkey to Program A, but nothing seems to work.

The idea of the script is simply to catch a hotkey and click in another window in addition to its normal function. The normal function just doesn't work.

Any ideas what could be the root of the problem and where I should look for it?

#IfWinActive, Program A
^H::
IfWinActive, Program A
   {
    ControlFocus, MDIClient1, Program A, , , 
    ControlSend, , ^H, Program A, , ,
    ControlClick, X46 Y135, Program B, , LEFT , 1
    return
   }
2

2 Answers

1
votes

One possibility - you're specifying X and Y coordinates, and those can be very relative. Large vs. Small Fonts, screen resolution, etc. could all cause issues.

That instruction is for Program B, so I'm not sure that that's your issue. You might try breaking out portions of the script and assigning them to different hotkeys, then trying them one at a time.

EDIT: I'd also try it in non-exe form (just a basic .ahk script) and see if that makes a difference.

1
votes

Other things to try:

  • Use ^h instead of ^H (uppercase)
  • Try a different hotkey to trigger the action
  • Toy with ~^H, which passes the original hotkey through (this might be tough, since you are doing some clicking after that -- not sure what the script is for)