明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1000|回复: 7

autohotkey可否替换autohook

[复制链接]
发表于 2020-4-8 20:32 | 显示全部楼层 |阅读模式
AHK文件中添加以下代码:
#IfWinActive ahk_exe acad.exe
        !l::send,{Esc}LINE{space}
        !p::send,{Esc}PLINE{space}
        !c::send,{Esc}COPY{space}
        !o::send,{Esc}CIRCLE{space}
        !m::send,{Esc}MIRROR{space}
        !i::send,{Esc}INSERT{space}
        !b::send,{Esc}BLOCK{space}
        !a::send,{Esc}ARRAY{space}
        !e::send,{Esc}PEDIT{space}M{space}

               
#IfWinActive


acad打开时,这些快捷键才起作用。
以第2行为示意:按下alt+l键,发送键 ESC 中止当前操作 输入LINE字符 再加空格。
发表于 2020-4-9 15:54 | 显示全部楼层
AUTOHOTKEY也可以用在CAD里吗
 楼主| 发表于 2020-4-9 17:00 | 显示全部楼层
设定的快捷键,只在autocad中启用。
发表于 2022-3-31 12:52 | 显示全部楼层
还是autohook好。
 楼主| 发表于 2022-9-27 20:39 | 显示全部楼层
switchime(ime := "A")
{
  if (ime = 1)
    {
      DllCall("SendMessage", UInt, WinActive("A"), UInt, 80, UInt, 1, UInt, DllCall("LoadKeyboardLayout", Str,"00000804", UInt, 1))
    }
  else If (ime = 0)
    {
      DllCall("SendMessage", UInt, WinActive("A"), UInt, 80, UInt, 1, UInt, DllCall("LoadKeyboardLayout", Str,, UInt, 1))
    }
   else If (ime = "A")
    {
      ;ime_status:=DllCall("GetKeyboardLayout","int",0,UInt)
      Send, #{Space}
    }
}


;在AutoCAD窗口下应用以下快捷键。
#IfWinActive ahk_exe acad.exe

  XButton1::F3
  XButton2::F8
  
  !q::
    switchime(0)
    send,{esc}qsave{space}         
  return
  !w::
    switchime(0)
    send,{esc}wblock{space}        
  return
  !e::
    switchime(0)
    send,{esc}explode{space}      
  return
  !r::
    switchime(0)
    send,{esc}rename{space}        
  return
  !t::
    switchime(0)
    send,{esc}trim{space}         
  return
  
  !a::
    switchime(0)
    send,{esc}array{space}         
  return
  !s::
    switchime(0)
    send,{esc}stretch{space}      
  return
  !d::
    switchime(0)
    send,{esc}dist{space}         
  return
  !f::
    switchime(0)
    send,{esc}find{space}         
  return
  !g::
    switchime(0)
    send,{esc}group{space}         
  return
  
  !z::
    switchime(0)
    send,{esc}zoom{space}o{space}  
  return
  !x::
    switchime(0)
    send,{esc}explode{space}      
  return
  !c::
    switchime(0)
    send,{esc}copy{space}         
  return
  !v::
    switchime(0)
    send,{esc}view{space}         
  return
  !b::
    switchime(0)
    send,{esc}block{space}         
  return
  
  !y::
    switchime(0)
    send,{esc}breakatpoint{space}  
  return
  !u::
    switchime(0)
    send,{esc}ucs{space}           
  return
  !i::
    switchime(0)
    send,{esc}insert{space}        
  return
  !o::
    switchime(0)
    send,{esc}offset{space}        
  return
  !p::
    switchime(0)
    send,{esc}pline{space}         
  return
  
  !h::
    switchime(0)
    send,{esc}dtext{space}         
  return
  !j::
    switchime(0)
    send,{esc}join{space}         
  return
  !k::
    switchime(0)
    send,{esc}dimaligned{space}   
  return
  !l::
    switchime(0)
    send,{esc}lengthen{space}      
  return
  
  !n::
    switchime(0)
    send,{esc}dimscale{space}      
  return
  !m::
    switchime(0)
    send,{esc}move{space}         
  return
  
 楼主| 发表于 2022-9-27 20:40 | 显示全部楼层
安装Autohotkey V1 版本后,把上面帖子的内容,另存为扩展为ahk的文件。双击。
可参内容修改。
发表于 2023-4-1 10:23 | 显示全部楼层
本帖最后由 pxt2001 于 2023-4-1 14:56 编辑

Autohotkey 似乎稳定性不好,经常异常退出导致快捷键起不到作用。
现在都有Autohotkey 2版本了 ,楼主的代码能否匹配新版本?
 楼主| 发表于 2023-4-10 16:58 | 显示全部楼层
pxt2001 发表于 2023-4-1 10:23
Autohotkey 似乎稳定性不好,经常异常退出导致快捷键起不到作用。
现在都有Autohotkey 2版本了 ,楼主的代 ...

没有写 V2的。V1稳定性还行。偶有异常。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-17 12:05 , Processed in 0.317901 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表