Bug with <Alt> send commands

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wiens
Posts: 26
Joined: 08 Dec 2015, 05:22

Bug with <Alt> send commands

27 Sep 2019, 04:15

Hello,

There is a bug in AHK in combination with AutoCAD. All <Alt> send commands are blocked after using the the command acad.ActiveDocument.SendCommand
The script stops at the <Alt> send command.
Can you confirm this.

Here is to AHK code to test on:
-----------------------------------------------------------------------------
#s:: ; Windows key + s (hotkey)
acad := ComObjActive("AutoCAD.Application")
Send {Sleep 50}
acad.ActiveDocument.SendCommand("_commandlinehide`n")
Send {Sleep 50}
Send !J ; Alt functions aren't working after the command acad.ActiveDocument.SendCommand
Return
-----------------------------------------------------------------------------
wiens
Posts: 26
Joined: 08 Dec 2015, 05:22

Re: Bug with <Alt> send commands

30 Sep 2019, 10:05

There is a topic on this in the AutoCAD forum:
https://forums.autodesk.com/t5/autocad-forum/keyboard-shortcuts-alt/td-p/2139188
It looks like it is by design in AutoCAD.

Removing the two lines given below from the script and using <Alt> functions, it will work then in the whole script.
acad := ComObjActive("AutoCAD.Application")
acad.ActiveDocument.SendCommand("_commandlinehide`n")

It would be nice if AHK could find a solution or a workaround to use the <Alt> button with the two lines above. I want to use the .SendCommand line in the script, because it is easier and faster.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Bug with <Alt> send commands

30 Sep 2019, 12:38

I can't help with the problem, as I don't have AutoCAD, but a few remarks:
• Send {Sleep 50} sends the sleep key 50 times, it doesn't wait 50 milliseconds. Depending on your send mode it may take a lot mode or less time, and possible trigger other things.
• Send !J sends Alt+Shift+j, also probably not what you intend.

To troubleshoot; do the alt hotkeys also fail when you perform them manually? Does it make a difference if you change focus to a different gui element or minimize restore the gui?

Mod edit: Moved from Bug reports to Ask for help.
wiens
Posts: 26
Joined: 08 Dec 2015, 05:22

Re: Bug with <Alt> send commands

30 Sep 2019, 14:58

Breaking the script in the middle and doing the <Alt> function mnanually works.
Send !J or Send !j both works without the two lines in it.

The issue is not only with AHK, but also with VBA.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, Google [Bot] and 141 guests