AutoCAD and Kensington Expert Mouse

Get help with using AutoHotkey and its commands and hotkeys
martyncowley
Posts: 3
Joined: 21 Feb 2018, 08:32

AutoCAD and Kensington Expert Mouse

21 Feb 2018, 08:55

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?
User avatar
divanebaba
Posts: 649
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: AutoCAD and Kensington Expert Mouse

26 Feb 2018, 23:45

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] [Download] GeSHi © Codebox Plus

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.

[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.
martyncowley
Posts: 3
Joined: 21 Feb 2018, 08:32

Re: AutoCAD and Kensington Expert Mouse

27 Feb 2018, 05:27

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.
User avatar
divanebaba
Posts: 649
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: AutoCAD and Kensington Expert Mouse

27 Feb 2018, 09:20

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] [Download] GeSHi © Codebox Plus

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?

[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.
martyncowley
Posts: 3
Joined: 21 Feb 2018, 08:32

Re: AutoCAD and Kensington Expert Mouse

01 Mar 2018, 05:36

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.
BoBo
Posts: 2515
Joined: 13 May 2014, 17:15

Re: AutoCAD and Kensington Expert Mouse

01 Mar 2018, 05:52

He won't provide his code. That's a fact :wtf:
User avatar
divanebaba
Posts: 649
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: AutoCAD and Kensington Expert Mouse

01 Mar 2018, 07:11

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] [Download] GeSHi © Codebox Plus

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.

[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 35 guests