Warning: getimagesize(): open_basedir restriction in effect. File(/etc/pki/tls/certs/ca-bundle.crt) is not within the allowed path(s): (/www/wwwroot/rinvay.cc/:/tmp/) in /www/wwwroot/rinvay.cc/usr/plugins/AMP/Action.php on line 469

Warning: failed loading cafile stream: `/etc/pki/tls/certs/ca-bundle.crt' in /www/wwwroot/rinvay.cc/usr/plugins/AMP/Action.php on line 469

Warning: getimagesize(): Failed to enable crypto in /www/wwwroot/rinvay.cc/usr/plugins/AMP/Action.php on line 469

Warning: getimagesize(https://www.rinvay.cc/img/logo.png): failed to open stream: operation failed in /www/wwwroot/rinvay.cc/usr/plugins/AMP/Action.php on line 469
ahk利用JScript编码函数

Rinvay.H Blog

ahk利用JScript编码函数


;sunwind 整理  
;2013-5-26 13:17:31  
;~ 编码函数,它输出符号的utf-8形式  
MsgBox % encode2UTF8("测试")  
encode2UTF8(Uri)  
{  
    oSC := ComObjCreate("ScriptControl")  
    oSC.Language := "JScript"  
    Script := "var Encoded = encodeURI(""" . Uri . """)"  
    oSC.ExecuteStatement(Script)  
    Return, oSC.Eval("Encoded")  
}

;~ http://www.autohotkey.com/board/topic/54431-scite4autohotkey-v300101-updated-nov-30-2012/page-44?hl=winhttp.winhttprequest#entry536165  
SetTitleMatchMode, 2  
WinGet, HWND, ID, SciTE4AutoHotkey  
Gui, Add, Edit, w100 vDesc, Pasted by SciTE  
Gui, Add, Edit, w100 vAuthor, GeekDude  
Gui, Add, Button, w100, Paste  
Gui, +Owner%HWnd% +ToolWindow  
Gui, Show,, Paste  
return    
Buttonpaste:  
Gui, Submit  
Gui, Destroy  
Gui, 1:Submit, NoHide  
oSciTE := ComObjActive("SciTE4AHK.Application")  
AhkBin(oSciTE.Document, Author, Desc, 1)  
ExitApp   
AhkBin(Txt, Author="GeekDude", Desc="Pasted by SciTE", Public=0)  
{  
    URL := "http://www.autohotkey.net/paste/"  
    POST:= "MAX_FILE_SIZE=262144"  
        .  "&jscheck="  
        .  "&text=" . UriEncode(Txt)  
        .  "&author=" . Author  
        .  "&description=" . UriEncode(Desc)  
        .  "&irc=" . (Public ? 100 : 0)  
        .  "&submit=Paste"      
    Pbin := ComObjCreate("WinHttp.WinHttpRequest.5.1")  
    Pbin.Open("POST", URL)  
    Pbin.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")  
    Pbin.Send(POST)  
    RegExMatch(Pbin.ResponseText, "<title>Paste #(.*?)</title>", pb_url)  
    File := FileOpen("Pastes.txt", "rw")  
    Txt .= File.Read()  
    File.pos := 0  
    File.Write(A_Now . "|" . URL . pb_url1 . "|" . Desc . "`r`n" . Txt)  
    File.Close()  
    if public  
        return URL . pb_url1  
    return  
}  
UriEncode(Uri)  
{  
    oSC := ComObjCreate("ScriptControl")  
    oSC.Language := "JScript"  
    Script := "var Encoded = encodeURIComponent(""" . FixJS(Uri) . """)"  
    oSC.ExecuteStatement(Script)  
    return oSC.Eval("Encoded")  
}   
UriDecode(Uri)  
{  
    oSC := ComObjCreate("ScriptControl")  
    oSC.Language := "JScript"  
    Script := "var Decoded = decodeURIComponent(""" . Uri . """)"  
    oSC.ExecuteStatement(Script)  
    return oSC.Eval("Decoded")  
}    
FixJS(JS)  
{  
    StringReplace, JS, JS,  \, \\, All ; Backslash  
    StringReplace, JS, JS, `b, \b, All ; Backspace  
    StringReplace, JS, JS, `f, \f, All ; Form feed  
    StringReplace, JS, JS, `n, \n, All ; New line  
    StringReplace, JS, JS, `r, \r, All ; Carriage return  
    StringReplace, JS, JS, `t, \t, All ; Tab  
    StringReplace, JS, JS, `v, \v, All ; Vertical tab  
    StringReplace, JS, JS,  ', \', All ; Single quote  
    StringReplace, JS, JS, `", \`", All ; Double quote  
    return JS  
}

当前页面是本站的「Baidu MIP」版。查看和发表评论请点击:完整版 »