Page 1 of 1

AutoCAD and Kensington Expert Mouse

Posted: 21 Feb 2018, 08:55
by martyncowley
I use a Kensington Expert Mouse K64325 with AutoHotKey to customise the button settings:

RButton & LButton::Send {ESC}{ESC}{ESC}
XButton1::Click right
XButton1 & MButton::Send {Del}
RButton::Send {Click 2}
RButton & XButton1::Send {u}{Enter}
RButton & MButton::Send {z}{Enter}{p}{Enter}

This has worked perfectly within AutoCAD LT for all versions up to the latest (2018) where I find that the additional button (XButton1) and the combinations are ignored - can anyone advise on how to re-instate the previous functionality, please?

Re: AutoCAD and Kensington Expert Mouse

Posted: 26 Feb 2018, 23:45
by divanebaba
Hello
and welcome to the AHK-Forum.
Your issue is a bit strange, because the XButton1 is captured by AHK and not by AutoCad.
I have ACAD 2018, German language, and it does (most time) what I want, even with my favourite XButton1.

Try

Code: Select all

XButton1 & MButton::
MsgBox Hello World
return
If this fails too, you have a real problem :mrgreen:
The commands in ACAD 2018 are different then the LT commands, but I think you have to correct setting the focus.
Your script could have still "old title" and sends the keystrokes to anywhere else.

Re: AutoCAD and Kensington Expert Mouse

Posted: 27 Feb 2018, 05:27
by martyncowley
Thanks for the response.
I think the problem is with AutoCAD LT, because now it is 'behaving' - after a fashion. The XButton1 and combinations are functioning as intended, except for RButton&LButton - it only appears to send 1 {ESC}, instead of three - one only cancels the current command, it does not cancel the object selection, so that the next command will operate on that object as well as that intended. I added a third to be certain.

Re: AutoCAD and Kensington Expert Mouse

Posted: 27 Feb 2018, 09:20
by divanebaba
Hi.
As I said, in my opinion, your script is generating the issues.
Without a look inside your code, I can not say reliable stuff.
One thing only, sending more than one keystroke, you can solve like below:

Code: Select all

RButton & LButton::Send {ESC 3} ; this sends three times escape-key
How about using COM? A few days ago, there was a similar request here.
Using the commands shown there is the most reliable way to interact with non-AHK-programs.
But using COM will not prevent having possible trouble with your hotkeys.

Normally you have to set focus to ACAD 2018, before you send keystrokes. Maybe this is causing trouble with ACAD 2018?

Re: AutoCAD and Kensington Expert Mouse

Posted: 01 Mar 2018, 05:36
by martyncowley
I am sure the problem is with AutoCAD - I have just started AutoCAD and opened a drawing via the 'Open' dialogue box and AutoHotkey is not working - even when trying to navigate the directory. YET, when I double-click a drawing file in Windows Explorer, a fresh instance of AutoCAD opens with that drawing and AutoHotkey is functioning! The first AutoCAD is still open and not following AutoHotkey. Previously, double-clicking a file in Windows Explorer would open the drawing in the current instance of AutoCAD.
The button mapping works in other applications, and sometimes in AutoCAD - as above - so I do not think it is necessary to 'set focus', which I do not know how to do, anyway.

Re: AutoCAD and Kensington Expert Mouse

Posted: 01 Mar 2018, 05:52
by BoBo
He won't provide his code. That's a fact :wtf:

Re: AutoCAD and Kensington Expert Mouse

Posted: 01 Mar 2018, 07:11
by divanebaba
Hmmm.
As I said, without a look inside your script, I could give you non-reliable support for the next 50 years witout any success.
Opening a new instance of ACAD seems to be standard when double clicking an ACAD-file in Explorer.

So I still believe, it is an focus problem. Providing this is possible with WinActivate. It could look like

Code: Select all

SetTitleMatchMode, 1 ; mathing mode: Title begins with ...

WinActivate, Autodesk AutoCAD 2018 - ; using beginning part of WinTitle
; or
WinActivate, ahk_class AfxMDIFrame140u ; using ahk_class
; or
WinActivate, ahk_exe acad.exe ; using process name
To find Titles, classes or process names, use Window Spy.