sync.ahk
按下 Shift+F9 时将选中内容复制后同步到服务端。Shift+F8 时将服务端的内容粘贴到光标位置。
#NoEnv #SingleInstance force codepage = 65001 +f9:: clipboard := "" Send ^c ClipWait data := clipboard url := "https://upall.cn/pasteboard/" whr := ComObjCreate("WinHttp.WinHttpRequest.5.1") whr.Open("POST", url, true) whr.SetRequestHeader("Content-Type", "x-www-form-urlencoded;charset=utf-8") whr.Send(data) whr.WaitForResponse() resText := whr.ResponseText MsgBox % resText return +f8:: url := "https://upall.cn/pasteboard/" whr := ComObjCreate("WinHttp.WinHttpRequest.5.1") whr.Open("GET", url, true) whr.Send() whr.WaitForResponse() clipboard := whr.ResponseText Send ^v return
server
error_reporting(0); $method = $_SERVER['REQUEST_METHOD']; if ($method == 'POST') { $data = file_get_contents("php://input"); $data or exit(); #file_put_contents('./plain.txt', "\n\n>>>>" . date('Y-m-d H:i:s') . "\n", FILE_APPEND); #$r = file_put_contents('./plain.txt', $data, FILE_APPEND); $r = file_put_contents('./plain.txt', $data); echo $r; } else if ($method == 'GET') { echo file_get_contents('./plain.txt'); } else { exit("unknown mehtod: $method"); }