Ahk excel格式刷快捷键定制

excel不支持ctrl+shift+c启动格式刷,

但是按alt后按h再按fp 可以启动格式刷

用ahk怎么替换热键呢

我试了半天老是在单元格输入fp 不能启动格式刷

^+c::

if WinActive(“ahk_exe excel.exe”)
{
Send !
Send H
Send F
Send P

}

return

哦要小写

image
我是把格式刷加入快速访问然后alt+1

ahk的大括号里这样写应该就行了,大小写不敏感
Send,!HFP

^+c::

if WinActive(“ahk_exe excel.exe”)
{
Send ^+c
Send !h!f!p

}
else
{
Send ^+c
}

return

自己写了个 但是word 的格式刷的快捷键ctrl+shift+c失效了 不知道哪里写错了

Certainly! Here’s an AutoHotKey (AHK) script that you can use to replace the Ctrl+Shift+C shortcut with Alt+H+F+P when Excel is active:

ahk复制代码

#IfWinActive, ahk_class XLMAIN ; Check if Excel is active

^+c:: ; Ctrl+Shift+C
    Send, !hfp ; Alt+H+F+P
    return

#IfWinActive ; Reset to default behavior outside of Excel

This script uses #IfWinActive to specify that the hotkey replacement should only occur when Excel is the active window (ahk_class XLMAIN). The ^+c:: defines the original hotkey (Ctrl+Shift+C), and Send, !hfp sends the new combination (Alt+H+F+P).

Make sure to save the script with a “.ahk” extension and run it using the AutoHotKey interpreter. Also, keep in mind that modifying keyboard shortcuts can affect your normal workflow, so use it with caution.

还是gpt好用