'*****************************************************************************
' FileName:            ANSIChrCode.VBS
'   Author:            baomaboy
' Abstract:            ASCII码表交互查询
'*****************************************************************************
Dim WshShell,FSO
On Error Resume Next
Set WshSHell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
CloseTime = 5
FileName = WScript.ScriptName
FileFullName = WScript.ScriptFullName
FilePath = FSO.GetParentFolderName(FileFullName)
InsPath = FSO.GetSpecialFolder(1)
InsFullName = FSO.BuildPath(InsPath ,FileName)
Copyright="Baomaboy"
QQ="QQ:25926183"
Email="Email:25926183@qq.com"
InsTitle="ASCII码表交互查询"
InsAnswer="ASCII码表交互查询"
RegPath1="HKEY_CLASSES_ROOT\Folder\shell\ANSIChrCode\"
RegValue1="ASCII码表交互查询"
RegForm1="REG_SZ"
RegPath2="HKEY_CLASSES_ROOT\Folder\shell\ANSIChrCode\command\"
RegValue2="wscript.exe " & chr(34) & InsFullName & chr(34)
RegForm2="REG_SZ"
IF FileFullName <> InsFullName then
intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - by baomaboy")
    If intAnswer = vbYes Then
WshSHell.RegWrite RegPath1,RegValue1,RegForm1
WshSHell.RegWrite RegPath2,RegValue2,RegForm2
FSO.GetFile(FileFullName).Copy(InsFullName)
WshSHell.popup _
"添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
, CloseTime, "安装成功 - "+ InsTitle +" - by baomaboy", 0 + 64
end if
        If intAnswer = vbNo Then
WshSHell.RegDelete RegPath2
WshSHell.RegDelete RegPath1
FSO.DeleteFile InsFullName
WshSHell.popup _
"删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"删除注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
, CloseTime, "卸载成功 - "+ InsTitle +" - by baomaboy", 0 + 64
end if
        If intAnswer = vbCancel Then
end if
ELSE
ins = True
outs = True
Do Until outs = False or ins = False
ins = InputBox(vbcr&"输入要查询的字符或编码:"&vbcr&vbcr&vbcr&"查控制符:则输入","ASCII码表交互查询 - By baomaboy","")
If ins <> "" Then
  if IsNumeric(ins) = False Then
  	if lcase(ins) = " " or lcase(ins) = "kg" then
  	inss = "空格":insv = ins
  	elseif lcase(ins) = "hh" then
  	inss = "换行":insv = chr(10)
  	elseif lcase(ins) = "hc" then
  	inss = "回车":insv = chr(13)
  	elseif lcase(ins) = "tg" then
  	inss = "退格":insv = chr(8)
  	elseif lcase(ins) = "zb" then
  	inss = "制表":insv = chr(9)
  	else
  	inss = mid(ins,1,1):insv = ins
  	end if
  	insv2 = ""
  	if Asc(insv) < 0 then insv2 = " 或 Chr(" & 65536 - abs(Asc(insv)) & ")"
  	outs = Inputbox(vbcr&vbcr&"查询结果:& inss &" ] 的对应编码是: ","ASCII码表交互查询 - By baomaboy","Chr(" & Asc(insv) & ")" & insv2)
  else
  	if int(ins) = 32 then
  	insb = "空格"
  	elseif int(ins) = 10 then
  	insb = "换行"
  	elseif int(ins) = 13 then
  	insb = "回车"
  	elseif int(ins) = 8 then
  	insb = "退格"
  	elseif int(ins) = 9 then
  	insb = "制表"
  	elseif int(ins) = 0 or int(ins) = 28 or int(ins) = 29 or int(ins) = 30 or int(ins) = 31 then
  	insb = "不能显示的字符"
  	else
  	insb = Chr(ins)
  	end if
    outs = Inputbox(vbcr&" 继续查询"&vbcr&vbcr&" 退出查询 "&vbcr&vbcr&"查询结果:Chr(" & ins & ") 的对应字符是: ","ASCII码表交互查询 - By baomaboy", insb)
  end if
End If
Loop
end if
Set WshSHell = Nothing
Set FSO = Nothing
Set Args = Nothing
WScript.Quit(0)
       
错了........没看清是要p的。     
 Last edited by baomaboy on 2008-5-26 at 12:17 AM ]