Skip to content

Instantly share code, notes, and snippets.

@emisjerry
Last active December 12, 2020 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emisjerry/6e51066b64b9c94d393ac7c18e876da8 to your computer and use it in GitHub Desktop.
Save emisjerry/6e51066b64b9c94d393ac7c18e876da8 to your computer and use it in GitHub Desktop.
Find text from a web page and execute it locally
#SingleInstance Force
#IfWinActive, ahk_exe chrome.exe
f2::
Send ^a
send ^c
text = %Clipboard%
; 找網址
RegExMatch(text, "z:\\test\\mp4\\(.*)\.mp4", file)
MsgBox 網址=%URL%
Run %file%
Clipboard = %URL%
Return
#IfWinActive
#SingleInstance Force
#IfWinActive, ahk_exe chrome.exe
f1::
Send ^a
send ^c
text = %Clipboard%
msgbox text=%text%
; 找檔名
RegExMatch(text, "z:\\test\\mp4\\(.*)\.mp4", file)
MsgBox mp4檔名=%file%
Clipboard = %file%
; 找網址
RegExMatch(text, "http(.?)://(.*)\.jpg", URL)
MsgBox 網址=%URL%
Clipboard = %URL%
; 找磁力鏈結
RegExMatch(text, "magnet:\?xt=urn:(.*)", URL)
MsgBox 磁力鏈結=%URL%
Clipboard = %URL%
Return
#IfWinActive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment