;网络剪贴板(作者:Vito.无关风月) ;功能说明: ;1 在不同的电脑上实现复制粘贴 ;2.快捷键 #c 复制选定文本或选定文件,#v在当前区域粘贴网络剪贴板内容 ;3.文件粘贴会默认粘贴至桌面 ;支持文本复制,以及文件复制,由于基于网络传输,不建议进行大文件(>5M)复制。 ;若用户独立使用网络剪贴板,需在https://netcut.cn上设定单独的剪贴板名称以及密码,即修改name_clip,passwd两项内容即可。 ; 2019-09-25 20:15 ;在 Vito.无关风月 原版的基础上增加了查询token和失效时间的功能 -- By fwt #SingleInstance force name_clip := "fwt" passwd := "avwoeuyt" temp := readfwebclip(name_clip,passwd, 1) note_token := temp[1] expire_time := temp[2] return #c:: Clipboard := "" send ^c TrayTip,, 正在上传至网络剪贴板。, , 16 ; 在原版基础上增加等待时间 ClipWait, 1 if DllCall("IsClipboardFormatAvailable", "uint", 1) { send2webclip(Clipboard,name_clip,passwd) } else if DllCall("IsClipboardFormatAvailable", "uint", 15) { path = %Clipboard% str := "FILE_flag" . path . "FILE_flag" . file2str(path) ;加上文件标识符,表明该字符串为文件的base64编码 StringReplace,str_new,str,+,@@,All ;由于上传到网络端的字符串+号会全部被替换为空格,因此提前将+替换为@@ send2webclip(str_new,name_clip,passwd) } else { MsgBox Clipboard does not contain files or text. return } TrayTip,, 上传完成, , 16 return 上传提示: TrayTip,, 正在上传至网络剪贴板。, , 16 return 下载提示: TrayTip,, 正在从网络剪贴板复制。, , 16 return #v:: Clipboard := "" TrayTip,, 正在从网络剪贴板复制。, , 16 str := readfwebclip(name_clip,passwd) StringLeft,flag,str,9 ;读取字符串的前9位 if(flag = "FILE_flag") { StringReplace,str,str,@@,+,All RegExMatch(str,"(? * Links: * GitHub: - https://github.com/cocobelgica/AutoHotkey-JSON * Forum Topic - http://goo.gl/r0zI8t * Email: - cocobelgicagmail com */ /** * Class: JSON * The JSON object contains methods for parsing JSON and converting values * to JSON. Callable - NO; Instantiable - YES; Subclassable - YES; * Nestable(via #Include) - NO. * Methods: * Load() - see relevant documentation before method definition header * Dump() - see relevant documentation before method definition header */ class JSON { /** * Method: Load * Parses a JSON string into an AHK value * Syntax: * value := JSON.Load( text [, reviver ] ) * Parameter(s): * value [retval] - parsed value * text [in, ByRef] - JSON formatted string * reviver [in, opt] - function object, similar to JavaScript's * JSON.parse() 'reviver' parameter */ class Load extends JSON.Functor { Call(self, ByRef text, reviver:="") { this.rev := IsObject(reviver) ? reviver : false ; Object keys(and array indices) are temporarily stored in arrays so that ; we can enumerate them in the order they appear in the document/text instead ; of alphabetically. Skip if no reviver function is specified. this.keys := this.rev ? {} : false static quot := Chr(34), bashq := "" . quot , json_value := quot . "{[01234567890-tfn" , json_value_or_array_closing := quot . "{[]01234567890-tfn" , object_key_or_object_closing := quot . "}" key := "" is_key := false root := {} stack := [root] next := json_value pos := 0 while ((ch := SubStr(text, ++pos, 1)) != "") { if InStr(" `t`r`n", ch) continue if !InStr(next, ch, 1) this.ParseError(next, text, pos) holder := stack[1] is_array := holder.IsArray if InStr(",:", ch) { next := (is_key := !is_array && ch == ",") ? quot : json_value } else if InStr("}]", ch) { ObjRemoveAt(stack, 1) next := stack[1]==root ? "" : stack[1].IsArray ? ",]" : ",}" } else { if InStr("{[", ch) { ; Check if Array() is overridden and if its return value has ; the 'IsArray' property. If so, Array() will be called normally, ; otherwise, use a custom base object for arrays static json_array := Func("Array").IsBuiltIn || ![].IsArray ? {IsArray: true} : 0 ; sacrifice readability for minor(actually negligible) performance gain (ch == "{") ? ( is_key := true , value := {} , next := object_key_or_object_closing ) ; ch == "[" : ( value := json_array ? new json_array : [] , next := json_value_or_array_closing ) ObjInsertAt(stack, 1, value) if (this.keys) this.keys[value] := [] } else { if (ch == quot) { i := pos while (i := InStr(text, quot,, i+1)) { value := StrReplace(SubStr(text, pos+1, i-pos-1), "\", "u005c") static tail := A_AhkVersion10 ? 10 : n) this.gap .= " " else this.gap := SubStr(space, 1, 10) this.indent := "`n" } return this.Str({"": value}, "") } Str(holder, key) { value := holder[key] if (this.rep) value := this.rep.Call(holder, key, ObjHasKey(holder, key) ? value : JSON.Undefined) if IsObject(value) { ; Check object type, skip serialization for other object types such as ; ComObject, Func, BoundFunc, FileObject, RegExMatchObject, Property, etc. static type := A_AhkVersion