Method 1: redefining Autocad's hotkeys without CUI command:
#IfWinActive, ahk_class AfxMDIFrame100u ; This is Autocad windows class (I am using version 2014) ^W::send, ^{F4} ; Closing the drawings become easyTo use the next methods you will need to add the following function to your script:
GetAcad() { try { global ACAD := ComObjActive("AutoCAD.Application") ; GetObject TrayTip, % "Connected to Autocad. Version " ACAD.version,% "Active drawing: "ACAD.activedocument.name, 1, 17 } }Method 2: Calling the built-in Autocad function using COM:
XButton1 & MButton:: +mbutton::GetAcad() ; Connect to Autocad using GetAcad() function (see code above) F5:: acad.activedocument.regen(1) ; REGENALL using F5Method 3: Calling Autocad's command line functions using COM:
#v:: acad.activedocument.sendcommand("_move`n") ; Start MOVE command using Winkey+V(note `n at the end of command, it will simulate the Enter key in autocad command line)
Method 4: Customizing the Autocad properties using COM. The following example quickly changes the model space background (useful when toggling between dark and light drawings and according to your mood
; Paste followng lines in the autoexecute section of script Colors:=Object() Colors[1]:=4067094 ; define your colors here Colors[2]:=12895428 Colors[3]:=12708854 SelectedColor:=1 ColorsCount:=3 ; add or remove colors and change this number accordingly ; And this comes to the hotkeys section - #IfWinActive, ahk_class AfxMDIFrame100u #F1:: SelectedColor:=SelectedColor+1 if SelectedColor > %ColorsCount% { SelectedColor:=1 } ; The next command wil change model space background: acad.Preferences.Display.GraphicsWinModelBackgrndColor := Colors[SelectedColor] ; The next command wil change Block Editor (BEDIT) background: acad.activedocument.sendcommand("(setenv ""BEditBackground"" """ Colors[SelectedColor] """)`n") ; A little bit of LISP, because .activedocument.setvariable "BEditBackground", 4067094 doesn't work returnEnjoy the Autocad forced by AHK