100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > AutoHotkey —— 自定义热键编辑软件(设置Typora字体颜色快捷键应用)

AutoHotkey —— 自定义热键编辑软件(设置Typora字体颜色快捷键应用)

时间:2021-07-24 13:47:05

相关推荐

AutoHotkey —— 自定义热键编辑软件(设置Typora字体颜色快捷键应用)

一、安装 AutoHotkey

官方安装链接:/download/ahk-install.exe

【home】Tab页:选择【Custom lnstallation】自定义安装;【version】Tab页:选择版本,与操作系统一致即可(我选择Unicode 64-bit);【location】Tab页:选择软件安装位置点击【next】继续安装;点击【install】软件就会安装;AutoHotkey安装完成,点击exit退出软件安装,点击其他可以打开软件帮助界面。

二、配置

在桌面新建一个 MyHotkeyScript.ahk文件,一记事本方式打开并复制以下代码:

; 分号以及分号后的内容代表注释,以下为代码解释#IfWinActive ahk_exe Typora.exe{; alt+0 黑色!0::addFontColor("black"); alt+1 红色!1::addFontColor("red"); alt+2 橙色!2::addFontColor("orange"); alt+3 黄色!3::addFontColor("yellow"); alt+4 绿色!4::addFontColor("green") ; alt+5 青色!5::addFontColor("cyan") ; alt+6 浅蓝色!6::addFontColor("cornflowerblue"); alt+7 紫色!7::addFontColor("purple")}; 快捷增加字体颜色addFontColor(color){clipboard := "" ; 清空剪切板Send {ctrl down}c{ctrl up} ; 复制; SendInput {Text} ; 解决中文输入法问题SendInput {TEXT}<font color='%color%'>SendInput {ctrl down}v{ctrl up}; 粘贴If(clipboard = ""){SendInput {TEXT}</font> ; Typora 在这不会自动补充}else{SendInput {TEXT}</ ; Typora中自动补全标签}}

三、运行

双击文件运行【用AutoHotkey运行】,打开AutoHotkey程序看见以下内容;

Script lines most recently executed (oldest first). Press [F5] to refresh. The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0). The bottommost line's elapsed time is the number of seconds since it executed.---- C:\Users\liang\Desktop\MyHotkeyScript.ahk003: {005: Return (58.16)Press [F5] to refresh.

重启Typora,测试快捷键是否有效,Alt + 01234567 分别是各种颜色。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。