Typora settings modify font color shortcuts

Table of contents

1. How to set shortcut keys to modify font color in typora

2. AutoHotKey software installation

 3. Typora's specific operations on AutoHotKey


1. How to set shortcut keys to modify font color in typora

Typora itself cannot directly modify the font color, but if you want to modify it, you can still use some code to change it, but it is troublesome to modify it every time. The full name of ahk is AutoHotKey. It is a powerful, easy-to-learn, Windows ultimate automation scripting language. We can use this language to meet our needs.

With the help of the AutoHotKey software, this problem can be solved very well. The software is about 10M, and there is no pressure at all. Well, put a blue cloud link:

https://wwix.lanzoue.com/iaxOg0ssx0fa

Password: b6oc

2. AutoHotKey software installation

Double-click the exe file to run the installation. You can choose the default installation or the custom installation. The default installation is the C drive. I am used to choosing the custom installation here.

This depends on your computer situation, I choose the second one here

 Set our own install location above

 Then you can exit after installation, click exit

 3. Typora's specific operations on AutoHotKey

In the installation directory of AutoHotKey just now, create a new txt file, and then copy the following code into it

#IfWinActive ahk_exe Typora.exe
{
    ; Ctrl+Alt+R 红色
    ^!r::addFontColor("red")
}
 
; 快捷增加字体颜色
addFontColor(color){
    Send {ctrl down}c{ctrl up} ; 复制
    SendInput {TEXT}<font color='%color%'>**
    SendInput {ctrl down}v{ctrl up} ; 粘贴
    If(clipboard = ""){
        SendInput {TEXT}**</font> ; Typora 在这不会自动补充
    }else{
        SendInput {TEXT}**</ ; Typora中自动补全标签
    }
}

I usually only use red, and there is no other requirement. If you want to add other colors, you can continue to add them below the sentence ^!r::addFontColor("red"). Everything after the semicolon is a comment.

Then change the suffix of the txt file to ahk, double-click the file to run it, and then you can happily modify the font color in typora~

4. Set the ahk file to start automatically at boot

Press win+R, enter shell:startup, and open the startup folder

 Then we can put in the files we want to boot automatically (copy or move)

 

Guess you like

Origin blog.csdn.net/weixin_63676550/article/details/130111682