WinClip.SetHTML(html)函数的使用

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: WinClip.SetHTML(html)函数的使用

WinClip.SetHTML(html)函数的使用

Post by wwww777 » 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
希望有朋友能够解答 :dance: :dance:

Top