I'm having inconsistent beavhior with ControlClick in Revit. I'm trying to use AHK to make shortcuts for things in revit that normally can't be assigned. Or to press multiple shortcuts at once. When using ControlClick to do this, the button is not always pressed. Sometimes I need to press the button multiple times before it clicks.
I've tried adding Winactivate and winwaitactive but I'm still getting the same behavior. I've tried it without the text, and at diferent times, 0, .1, .5, blank. Still can't get it to be consistent:
F11:: ;Edit Parameter
WinActivate, Family Types, &Modify...
WinWaitActive, Family Types, &Modify..., 1
Controlclick, &Modify..., Family Types
return
F12:: ;New Parameter
WinActivate, Family Types, A&dd...
WinWaitActive, Family Types, A&dd..., 1
ControlClick, A&dd..., Family Types
return
Below is the original:
#NoEnv ;Recommended for performance and compatibility with future AutoHotKey releases
#IfWinActive ahk_exe Revit.exe ;active in Revit
#SingleInstance force ;skips a dialog box when reloading the script after editing
F2:: ;Open selected section.
MouseClick, right
send, {g}
F3:: ;Toggle Link, underlay, and pinned locks.
send, {[ 2}
send, {] 2}
send, {\ 2}
return
F4:: ;clicks on family type pulldown, works when placing families or when changing type of family in place.
click, -190, 70
return
F5:: ;Toggle leader on tag
ControlClick, Leader, Autodesk Revit
return
F6:: ;Toggle Multiple when coping
ControlClick, Multiple, Autodesk Revit
return
+F4:: ;Edit Type
click, -68, 125
return
!F6:: ;Toggle Constrain when copying
ControlClick, Constrain, Autodesk Revit
return
;Family commands
;Family Type Commands
F11:: ;Edit Parameter
Controlclick, &Modify..., Family Types
return
F12:: ;New Parameter
ControlClick, A&dd..., Family Types
return
I would recommend trying the suggestions in the "Reliability" section for ControlClick
in the help file, namely, using the "NA" option and/or SetControlDelay -1
. If those don't work, I would try setting the "ClickCount" parameter to something higher than 1. Finally, if that doesn't work, I would recommend looping the ControlClick
command on the problem-hotkeys in order to simulate multiple clicks.
Alternatively, do alt
+d
and alt
+m
work? If so, you could just have it send those. (Send , !a
or Send , !m
)
I don't know why ControlClick
behavior is inconsistent in Revit, but I hopes this gets it working better.