WinClip.SetHTML(html)函数的使用
Posted: 21 Feb 2023, 22:21
本人最近在用印象笔记,但是印象笔记本身的编辑能力属实有点弱,所以想用autohotkey实现一个最简单的快捷键功能:按下某快捷键(比如Alt + R),就能让印象笔记中的选中的文字变红色,GitHub有一个现成的(https://github.com/gomingge/Evernote-editor)但是一直无效,所以自己单独写了个。但是卡在 将剪切板的文字通过html设为红色并复制到印象笔记这一步,现在的代码能够把选中的文字复制到剪切板,但是印象笔记中的文字没有改变,下面是代码:
希望有朋友能够解答
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#IfWinActive, ahk_exe evernote.exe ;设置只有在印象笔记中才生效
^r::
clipboard =
Send ^c
ClipWait, 1
t := WinClip.GetText()
html = <span style='color: #F02E37;'><b>%t%</b></span>
WinClip.SetHTML(html)
Sleep, 300
Send ^v
WinClip.Clear()
Return