Skip to content

Instantly share code, notes, and snippets.

tmplinshi

Block or report user

Report or block tmplinshi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Imgur_UploadFromClipboard.ahk
#Include <Gdip_All>
MsgBox, % link := Imgur_UploadFromClipboard("Your_Client_ID")
Run, % link
Imgur_UploadFromClipboard(ClientID) {
body := ClipImageToByteArray()
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
; whr.SetProxy(2, "localhost:1080")
whr.Open("POST", "https://api.imgur.com/3/image", "true")
View pageNav.ahk
; https://www.autohotkey.com/boards/viewtopic.php?f=28&t=61347
; F8::pageNav("pre") ; 上一页
; F9::pageNav("next") ; 下一页
pageNav(cmd = "next") {
static js
if (!js)
{
js =
View FindAddressBar.ahk
; js := "void(document.getElementById('keywords').value='Hello world 1')"
; ChromeRunJs(js)
ChromeRunJs(ByRef js) {
static addrBar
if !addrBar || !WinExist("ahk_id " addrBar.hWnd) {
if !addrBar := FindAddressBar() {
throw "FindAddressBar failed."
}
@tmplinshi
tmplinshi / auto_resize_example.ahk
Last active Sep 6, 2019
basic example of how to do auto sizing.
View auto_resize_example.ahk
Gui, +Resize
Gui, Add, Edit, w250 h100 vEditField
Gui, Add, Button, Section, Start
Gui, Add, Button, yS, Stop
Gui, Show, Center
Return
GuiSize:
if !initSize {
GuiControlGet, c1, Pos, EditField
View RegExReplaceF.ahk
; RegExReplaceF(Haystack, NeedleRegEx, FunctionName [, OutputVarCount := "", Limit := -1, StartingPosition := 1])
; Examples
/*
str := "a 100 b 200"
MsgBox % RegExReplaceF(str, "\d+" , "Add8") ; -> "a 108 b 208"
MsgBox % RegExReplaceF(str, "O)(\d+)", "Add5") ; -> "a 105 b 205"
MsgBox % RegExReplaceF(str, "O)(\d+)", Func("AddN").Bind(3)) ; -> "a 103 b 203"
Add8(match) {
View RestartNetwork.ahk
/*
Restart "Local area connection" without admin privileges
Example: RestartNetwork("Local area connection")
If ConnectionName is omited, the adapter name that contains "Realtek PCIe" will be selected.
*/
RestartNetwork(ConnectionName := "") {
oShell := ComObjCreate("Shell.Application")
View AHKHID - example_3 修改版.ahk
; AHKHID - example_3 修改版.ahk
/*! TheGood
AHKHID - An AHK implementation of the HID functions.
AHKHID Example 3
Last updated: August 22nd, 2010
Monitors the mouse movements and button state changes.
This is a good example showing how to use the RI_MOUSE flags of the member II_MSE_BUTTONFLAGS.
___________________________________________________________
View 监测正在使用的键盘或鼠标.ahk
; 监测正在使用的键盘或鼠标.ahk
; https://autohotkey.com/board/topic/21283-native-hid-support/?p=139818
#NoEnv
; Disable this line if you're running from an editor that catches StdOut
; (like PSPad or SciTE.)
DllCall("AllocConsole")
OnMessage(0xFF, "WM_INPUT")
View DigestAuth.ahk
; https://en.wikipedia.org/wiki/Digest_access_authentication
class DigestAuth
{
Build(username, password, method, uri, ByRef WWWAuthenticate) {
Loop, Parse, % "realm|qop|algorithm|nonce|opaque", |
RegExMatch(WWWAuthenticate, A_LoopField "=""?\K[^,""]+", %A_LoopField%)
cnonce := this.create_cnonce()
nonceCount := "00000001"
View Chrome_GetTabList.ahk
Chrome_GetTabList() {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://localhost:9222/json")
whr.Send()
out := []
for i, tab in Jxon_Load(whr.ResponseText)
{
if (tab.type = "page")
out.push( {url: tab.url, title: tab.title} )
You can’t perform that action at this time.