我想制作一个 AutoHotkey 脚本来更改 PuTTY SSH 客户端中的字体。(我更喜欢小字体以获得高信息密度,但是当我向同事展示某些东西时,他们需要能够清楚地看到它。)我已经做到了这一点:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance force ; Lets the RunMe plugin for Notepad++ reload the script with Shift-F5.
#IfWinActive ahk_class PuTTY ; If PuTTY is active
^+1:: ; and Ctrl-Shift-1 is pressed
{
Send !{Space} ; Alt-Space to open the system menu
Send g ; open Change Settings
Send !g ; select the Category menu
Send w ; select the Window category
Send {Right} ; expand the category
Send a ; select the Appearance subcategory
ControlClick, ClassNN Button8, ahk_class PuTTYConfigBox, , Left, 1
}
#IfWinActive
当从 PuTTY 终端窗口运行时,通过“发送 a”的所有内容都按预期导航 PuTTY 菜单,将我带到外观子类别。此时我想点击“更改...”按钮来设置字体。我不希望发送一堆选项卡或指定屏幕坐标来选择按钮;因为这看起来很笨拙,并且可能会随着未来的更新而中断。不过,我无法让 ControlClick 工作。经过几个小时的研究,我上面使用的这条线是我最好的猜测,我不明白为什么它什么也没做。
这是我将鼠标悬停在按钮上时的 Window Spy 输出:
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
PuTTY Reconfiguration
ahk_class PuTTYConfigBox
>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 1051, 207 (less often used)
In Active Window: 432, 202
>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
ClassNN: Button8
Text: Change...
Color: 0xF0F0F0 (Blue=F0 Green=F0 Red=F0)
>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: 619 top: 5 width: 456 height: 438
>>>>>>>>>>>( Status Bar Text )<<<<<<<<<<
>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
&Apply
&Cancel
Cate&gory:
Cursor appearance:
B&lock
&Underline
&Vertical line
Cursor &blinks
Adjust the use of the cursor
Fo&nt used in the terminal window
Font: Lucida Console, 24-point
Change...
Allow selection of variable-pitch fonts
Font &quality:
Antialiased
Non-Antialiased
ClearType
Default
Font settings
Hide mouse &pointer when typing in window
Adjust the use of the mouse pointer
Gap b&etween text and window edge:
&Sunken-edge border (slightly thicker)
Adjust the window border
>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<
>>>>( TitleMatchMode=slow Visible Text )<<<<
1
>>>>( TitleMatchMode=slow Hidden Text )<<<<
谢谢你的帮助。