您的位置:首页 > 其它

[AHK]利用AutoHotkey辅助设计

2016-12-26 20:26 344 查看
抛砖引玉

案例1:在cad里边的用热字串辅助输入 这样画图快,比如rec100,这类rec后面的XXX数值不固定的,从10到10000吧

:*:rec::
Input, UserInput, V T5 L5 C, {enter}.{esc}{tab}, *
if  UserInput is integer
{
send rec{space}{click}d{space}%UserInput%{space}%UserInput%{space}{click}
}
return


案例2:在3DSMAX中直接用快捷键将对象Z坐标旋转90度,因为旋转90用的最多,这样就不用老是在移动和旋转之间切换.



^+R::
test = rotate $ (angleaxis 90 [0,0,1])
ControlFocus, MXS_Scintilla2, ahk_exe 3dsmax.exe
ControlSetText, MXS_Scintilla2, %test%, ahk_exe 3dsmax.exe
send, +{Enter}
Return

效果:



只在3dsmax界面上生效的热键,这个就只是在max的Label1窗口起作用,

在其他地方6还是6,

#If ActiveControlIs("Label1")
6::Send {F5}
7::MsgBox
#If

ActiveControlIs(Control) {
ControlGetFocus, FocusedControl, A
return (FocusedControl=Control)
}


案例3:以下是用于减小PhotoShop占用内存的示范,可以改造成定时调用EmptyMem

Run, "C:\Program Files\Adobe\Adobe Photoshop CS3\Photoshop.exe",,,PID ;取得 PID
WinWait, ahk_class Photoshop ;等待窗口出现
Sleep, 10000 ;应用之前须保证 photoshop 启动加载完毕
EmptyMem(PID) ;将第一行取得的  photoshop 的 PID 放在这里
Exitapp

EmptyMem(PID="AHK Rocks"){
pid:=(pid="AHK Rocks") ? DllCall("GetCurrentProcessId") : pid
h:=DllCall("OpenProcess", "UInt", 0x001F0FFF, "Int", 0, "Int", pid)
DllCall("SetProcessWorkingSetSize", "UInt", h, "Int", -1, "Int", -1)
DllCall("CloseHandle", "Int", h)
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: