Skip to content

Instantly share code, notes, and snippets.

@codexss
Last active September 1, 2024 12:50
Show Gist options
  • Save codexss/03ca2290a89d8becf6c39286b0af537c to your computer and use it in GitHub Desktop.
Save codexss/03ca2290a89d8becf6c39286b0af537c to your computer and use it in GitHub Desktop.
Win+C 推送
#Requires AutoHotkey v2.0
#SingleInstance force
#NoTrayIcon
#c::
{
A_Clipboard := ""
Send "^c"
if !ClipWait(2)
return
HTTP := ComObject("WinHttp.WinHttpRequest.5.1")
HTTP.Open("GET", "https://bark.day.app/[token]/" . URIEncode(A_Clipboard) . "?autoCopy=1&isArchive=0")
HTTP.Send()
}
URIEncode(str) {
var := Buffer(StrPut(str, "UTF-8"), 0)
StrPut(str, var, "UTF-8")
pos := 1
While pos < var.Size {
code := NumGet(var, pos - 1, "UChar")
if (code >= 0x30 && code <= 0x39) || (code >= 0x41 && code <= 0x5A) || (code >= 0x61 && code <= 0x7A)
res .= Chr(code)
else
res .= Format("%{:02X}", Code)
pos++
}
return res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment