#SingleInstance force
SetBatchLines, -1
~^v::
if ClipboardGet_HTML(html)
{
RegExMatch(html, "(*ANYCRLF)SourceURL:\K.*", sourceURL)
SendInput, {Raw}`nSource: %sourceURL%
}
Return
ClipboardGet_HTML( byref Data ) { ; www.autohotkey.com/forum/viewtopic.php?p=392624#392624
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If ( DllCall( "IsClipboardFormatAvailable", UInt,CBID ) && DllCall( "OpenClipboard", UInt,0 ) )
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
在复制网页内容后,可以用上面代码从剪贴板获取copy的来源网址