in WinClip.ahk replace this
Code: Select all
GetHtml()
{
if !( clipSize := this._fromclipboard( clipData ) )
return ""
if !( out_size := this._getFormatData( out_data, clipData, clipSize, "HTML Format" ) )
return ""
return strget( &out_data, out_size, "CP0" )
}
Code: Select all
GetHtml(enc:="UTF-8")
{
if !( clipSize := this._fromclipboard( clipData ) )
return ""
if !( out_size := this._getFormatData( out_data, clipData, clipSize, "HTML Format" ) )
return ""
return strget( &out_data, out_size, enc )
}
2) use this script (and change the path inside):
Code: Select all
;++++++++++++++++++ copy google docs comment (get html, replace b/i tags with *, remove all html tags, past as text)
#Include C:\Users\xxx\modul_ahk\WinClip\WinClip.ahk
#Include C:\Users\xxx\modul_ahk\WinClip\WinClipAPI.ahk
wc := new WinClip
; shortcut will only work on google docs
SetTitleMatchMode, Regex
#If WinActive("Google Docs ahk_class Chrome_WidgetWin_1", Tweaks)
^!+d::
WinClip.Copy()
t := WinClip.GetHTML()
; if you add a single space before/after the markdown symbol, GoogleDocs ignore the markdown symbol -so we replace then with a random place holder (df4523ght) and then in "text" mode we replace if with a single space (cf end of the script)
StringReplace t, t,% "<b ", % "df4523ght*<b ", A
StringReplace t, t,% "</b>", % "</b>*df4523ght", A
StringReplace t, t,% "<i ", % "df4523ght_<i ", A
StringReplace t, t,% "</i>", % "</i>_df4523ght", A
StringReplace t, t,% "<br ", % "`n<br ", A
; remove all html tags
t := RegExReplace(t, "<.*?>")
; remove all first line of hmtl = fragment, urlsource....
t:=RegExReplace(t,"^.*?\R.*?\R.*?\R.*?\R.*?\R.*?\R.*?\R.*?\R")
; replace space placeholder
StringReplace t, t,% "df4523ght", % " ", A
clipboard = %t%
TrayTip Clipboard, Clipboard Ready, 1
return
Code: Select all
#Include %A_ScriptDir%\ahk_apps\copy_gdoc_comment_with_formatting.ahk