Skip to content

Instantly share code, notes, and snippets.

; Google Drive API test
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
; http://www.howtosolvenow.com/how-to-create-your-google-drive-api-keys/
; http://www.howtosolvenow.com/how-to-get-refresh-token-for-google-drive-api/
client_id := "xxxxxxxxxxx"
client_secret := "xxxxxxxxxxx"
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://gist.github.com/tmplinshi/b13952a5566ef3b5f05c7e03452002f1');
await page.waitForSelector('#gist-share-url');
const element = await page.$('#gist-share-url');
await element.focus();
#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")
; 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 =
; 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 September 6, 2019 15:31
basic example of how to do auto sizing.
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
; 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) {
/*
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")
; 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.
___________________________________________________________
; 监测正在使用的键盘或鼠标.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")