技术标签: XP的html编辑器
这几天不能访问的时候把硬盘上的东东复习了一遍,找出了这个东西出来,由于水平有限,而且对DHTML没有什么研究,所以做得很是粗糙,贴上来是为了抛砖引玉,希望有高人能帮忙修改或拿出更优秀的东东出来。
测试环境为windows XP 专业版 SP2,暂时发现代码着色方面有Bug,虽然已有解决方法,不过由于代码量的原因(用记事本写代码真的很恼火),暂时未纠正,另外预计将来加入自动完成等功能。
ps:利用VBS脚本+DHTML,主要功能由正则表达式+wmic来完成,代码需保存为HTA类型的文件,当然也可以更改为纯粹的VBS脚本,不过那样效率低多了,而且代码更复杂。
代码编辑器'*******************************************************************'
'脚本开始
'*******************************************************************'
Set shell=CreateObject("WScript.Shell")
Set fso=CreateObject("Scripting.FileSystemObject")
'*******************************************************************'
'遍历本地所有类型文件
'*******************************************************************'
Sub OptionAdd(fExt)
str = ""
Set objDataFiles = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colFiles = objDataFiles. _
ExecQuery("Select * from CIM_DataFile where extension = '" & fExt & "'")
For Each objFile in colFiles
str = str & "" & _
objFile.name & ""
next
str = "本地脚本文件:" & str & ""
forOption.innerHTML = str
end Sub
'*******************************************************************'
'颜色转换
'*******************************************************************'
Sub ChangeColor
if cxs.value = "vbs" then
WinMain.innerHTML = ChangeVBS(WinMain.innerText)
else 'CMD脚本
WinMain.innerHTML = ChangeCMD(WinMain.innerText)
end if
end Sub
'*******************************************************************'
'VBS转换模块
'*******************************************************************'
Function ChangeVBS(sText)
Set re=new RegExp
re.IgnoreCase =true
re.Global=true
'注释转换
re.Pattern = "(\'.*)\r\n"
sText = re.Replace(sText,"$1
")
'转换符号为[蓝色]
re.Pattern = "(\(|\)|\&|\+|\-|\*|\%|\:|\;|\.|\""" & ")"
sText = re.Replace(sText,"$1")
sText = "
"style='word-break:break-all'>
" " & sText & " |
sText = Replace(sText,chr(13) & chr (10) ,"
")'转换保留字为[蓝色]
re.Pattern="(\bAnd\b|\bByRef\b|\bByVal\b|\bCall\b" & _
"|\bCase\b|\bClass\b|\bConst\b|\bDim\b|\bDo\b" & _
"|\bEach\b|\bElse\b|\bElseIf\b|\bEmpty\b|\bEnd\b" & _
"|\bEqv\b|\bErase\b|\bError\b|\bExit\b|\bExplicit\b" & _
"|\bFalse\b|\bFor\b|\bFunction\b|\bGet\b|\bIf\b|\bImp\b" & _
"|\bIn\b|\bIs\b|\bLet\b|\bLoop\b|\bMod\b|\bNext\b|\bNot\b" & _
"|\bNothing\b|\bNull\b|\bOn\b|\bOption\b|\bOr\b|\bPrivate\b" & _
"|\bProperty\b|\bPublic\b|\bRandomize\b|\bReDim\b|\bRem\b" & _
"|\bResume\b|\bSelect\b|\bSet\b|\bStep\b|\bSub\b|\bThen\b" & _
"|\bTo\b|\bTrue\b|\bUntil\b|\bWend\b|\bWhile\b|\bXor\b|Vb[a-z]*)"
sText=re.Replace(sText,"$1")
'转换函数和对象为[红色]
re.Pattern="(\bAnchor\b|\bArray\b|\bAsc\b|\bAtn\b" & _
"|\bCBool\b|\bCByte\b|\bCCur\b|\bCDate\b|\bCDbl\b" & _
"|\bChr\b|\bCInt\b|\bCLng\b|\bCos\b|\bCreateObject\b" & _
"|\bCSng\b|\bCStr\b|\bDate\b|\bDateAdd\b|\bDateDiff\b" & _
"|\bDatePart\b|\bDateSerial\b|\bDateValue\b|\bDay\b" & _
"|\bDictionary\b|\bDocument\b|\bElement\b|\bErr\b|\bExp\b" & _
"|\bFileSystemObject \b|\bFilter\b|\bFix\b|\bInt\b|\bForm\b" & _
"|\bFormatCurrency\b|\bFormatDateTime\b|\bFormatNumber\b" & _
"|\bFormatPercent\b|\bGetObject\b|\bHex\b|\bHistory\b|\bHour\b" & _
"|\bInputBox\b|\bInStr\b|\bInstrRev\b|\bIsArray\b|\bIsDate\b" & _
"|\bIsEmpty\b|\bIsNull\b|\bIsNumeric\b|\bIsObject\b|\bJoin\b" & _
"|\bLBound\b|\bLCase\b|\bLeft\b|\bLen\b|\bLink\b|\bLoadPicture\b" & _
"|\bLocation\b|\bLog\b|\bLTrim\b|\bRTrim\b|\bTrim\b|\bMid\b" & _
"|\bMinute\b|\bMonth\b|\bMonthName\b|\bMsgBox\b|\bNavigator\b" & _
"|\bNow\b|\bOct\b|\bReplace\b|\bRight\b|\bRnd\b|\bRound\b" & _
"|\bScriptEngine\b|\bScriptEngineBuildVersion\b" & _
"|\bScriptEngineMajorVersion\b|\bScriptEngineMinorVersion\b" & _
"|\bSecond\b|\bSgn\b|\bSin\b|\bSpace\b|\bSplit\b|\bSqr\b" & _
"|\bStrComp\b|\bString\b|\bStrReverse\b|\bTan\b|\bTime\b" & _
"|\bTextStream\b|\bTimeSerial\b|\bTimeValue\b|\bTypeName\b" & _
"|\bUBound\b|\bUCase\b|\bVarType\b|\bWeekday\b|\bWeekDayName\b" & _
"|\bWindow\b|\bYear\b|\bWscript\b)"
sText=re.Replace(sText,"$1")
ChangeVBS = sText
end Function
'*******************************************************************'
'CMD转换模块
'*******************************************************************'
Function ChangeCMD(sText)
Set re=new RegExp
re.IgnoreCase =true
re.Global=true
'等号转换
'sText = Replace(sText,"/","/")
re.Pattern = "(\%|\=|\/[a-z]*\b|\>|\
sText = re.Replace(sText,"$1")
'注释转换
re.Pattern = "(Rem\b.*\r\n|\bRem\b.*)"
sText = re.Replace(sText,"$1")
'改变符号的颜色
re.Pattern = "(\(|\)|\&|\+|\-|\*|\;|\""" & ")"
sText = re.Replace(sText,"$1")
'改变所有命令的颜色
re.Pattern = "(\bShare\b|\bSetver\b|\bNlsfunc\b|\bMem\b|\bLh\b" & _
"|\bLoadhigh\b|\bloadfix\b|\bGraphics\b|\bForcedos\b" & _
"|\bFastopen\b|\bExe2bin\b|\bEdlin\b|\bEdlin\b|\bEdit\b" & _
"|\bDebug\b|\bDebug\b|\bAppend\b|\bSwitches\b|\bStacks\b" & _
"|\bShell\b|\bNtcmdprompt\b|\bLastdrive\b|\bInstall\b" & _
"|\bFiles\b|\bFcbs\b|\bEchoconfig\b|\bDriveparm\b|\bDosonly\b" & _
"|\bDos\b|\bDevicehigh\b|\bDevice\b|\bCountry\b|\bBuffers\b" & _
"|\bXcopy\b|\bWMIC\b|\bWinnt32\b|\bWinnt\b|\bW32tm\b" & _
"|\bVssadmin\b|\bVol\b|\bVerify\b|\bVer\b|\bUnlodctr\b" & _
"|\bTypeperf\b|\bType\b|\bTree\b|\bTracert\b|\bTracerpt\b" & _
"|\bTitle\b|\bTime\b|\bTftp\b|\bTelnet\b|\bTcmsetup\b" & _
"|\bTasklist\b|\bTaskkill\b|\bSfc\b|\bSysteminfo\b|\bSubst\b" & _
"|\bStart\b|\bSort\b|\bShutdown\b|\bShift\b|\bSetlocal\b|\bSet\b" & _
"|\bSecedit\b|\bSchtasks\b|\bSc\b|\bRunas\b|\bRsm\b|\bRsh\b" & _
"|\bRoute\b|\bRmdir\b|\bRexec\b|\bReset\b|\bReplace\b|\bRename\b" & _
"|\bRelog\b|\bRegsvr32\b|\bReg\b|\bRecover\b|\bRcp\b|\bRasdial\b" & _
"|\bQuery\b|\bPushd\b|\bPrompt\b|\bPrnqctl\b|\bPrnport\b" & _
"|\bPrnmngr\b|\bPrnjobs\b|\bPrndrvr\b|\bPrncnfg\b|\bPrint\b" & _
"|\bPopd\b|\bPing\b|\bPerfmon\b|\bPentnt\b|\bPbadmin\b|\bPause\b" & _
"|\bPathping\b|\bPath\b|\bPagefileconfig\b|\bOpenfiles\b|\bNtsd\b" & _
"|\bNtcmdprompt\b|\bNtbackup\b|\bNslookup\b|\bNetstat\b|\bNetsh\b" & _
"|\bNet\b|\bNbtstat\b|\bMsinfo32\b|\bMsiexec\b|\bMove\b" & _
"|\bMountvol\b|\bMore\b|\bMode\b|\bMmc\b|\bMd\b|\bMkdir\b" & _
"|\bMacfile\b|\bLpr\b|\bLpq\b|\bLogman\b|\bLodctr\b|\bLabel\b" & _
"|\bIrftp\b|\bIpxroute\b|\bIpseccmd\b|\bIpconfig\b|\bIf\b" & _
"|\bHostname\b|\bHelpctr\b|\bHelp\b|\bGraftabl\b|\bGpupdate\b" & _
"|\bGpresult\b|\bGoto\b|\bGetmac\b|\bFtype\b|\bFtp\b|\bFsutil\b" & _
"|\bFormat\b|\bFor\b|\bFlattemp\b|\bFinger\b|\bFindstr\b|\bFind\b" & _
"|\bFc\b|\bExpand\b|\bExit\b|\bEvntcmd\b|\bEventtriggers\b" & _
"|\bEventquery\b|\bEventcreate\b|\bEndlocal\b|\bEcho\b" & _
"|\bDriverquery\b|\bDoskey\b|\bDiskPart\b|\bDiskcopy\b" & _
"|\bDiskcomp\b|\bDir\b|\bDel\b|\bDefrag\b|\bDate\b|\bCScript\b" & _
"|\bCprofile\b|\bCopy\b|\bConvert\b|\bCompact\b|\bComp\b" & _
"|\bCmstp\b|\bCmd\b|\bCls\b|\bCipher\b|\bChkntfs\b|\bChkdsk\b" & _
"|\bChdir\b|\bChcp\b|\bChange\b|\bCall\b|\bCacls\b|\bBreak\b" & _
"|\bBootcfg\b|\bAttrib\b|\bAtmadm\b|\bAt\b|\bAssoc\b|\bArp\b)"
sText=re.Replace(sText,"$1")
sText = "
"style=""word-break:break-all"">
"
" & sText & ""sText = Replace(sText,chr(13) & chr (10) ,"
")ChangeCMD = sText
end Function
'*******************************************************************'
'帮助窗口
'*******************************************************************'
set oPopup = window.createPopup
sub HelpWindow
if usehelp.checked then
set oPopBody = oPopup.document.body
oPopBody.style.backgroundColor = "lightyellow"
oPopBody.style.border = "solid black 1px"
oPopBody.innerHTML = "帮助功能未完成,取消帮助见右下角"
oPopup.show WinMain.offsetleft, _
WinMain.offsettop + WinMain.offsetheight - 20, _
WinMain.offsetWidth, 20, document.body
end if
end sub
'*******************************************************************'
'运行代码
'*******************************************************************'
Sub RunCode
if cxs.value = "vbs" then
tmpfile = "temp_script.vbs"
str = tmpfile
else
tmpfile = "temp_script.bat"
str = "cmd /k " & tmpfile
end if
Set file = fso.OpenTextFile(tmpdir & tmpfile,2,True)
file.Write WinMain.innerText
file.Close
shell.Run str
End Sub
'*******************************************************************'
'保存文件
'*******************************************************************'
Sub SaveFile
Set objDialog = CreateObject("SAFRCFileDlg.FileSave")
objDialog.FileName = Cstr(date)
if cxs.value = "vbs" then
objDialog.FileType = ".vbs"
else
objDialog.FileType = ".bat"
end if
intReturn = objDialog.OpenFileSaveDlg
If intReturn Then
Set objFile = fso.CreateTextFile( _
objDialog.FileName & objDialog.FileType)
objFile.WriteLine WinMain.innerText
objFile.Close
end if
end Sub
'*******************************************************************'
'打开文件
'*******************************************************************'
Sub OpenFile
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "bat文件|*.bat;*.cmd|vbs 文件|*.vbs|所有文件|*.*"
'objDialog.MaxFileSize = 10000
'objDialog.FilterIndex = 1
'objDialog.InitialDir = ""
objDialog.ShowOpen
'strLoadFile = objDialog.FileName
If len(trim(objDialog.FileName)) = 0 Then Exit Sub
Set objFile = fso.OpenTextFile(objDialog.FileName,1,True)
WinMain.innerText = objFile.ReadAll
end Sub
'*******************************************************************'
'启动时自动移动到屏幕中心
'*******************************************************************'
Sub Window_OnLoad()
self.ResizeTo 1,1
self.MoveTo 300,300
'显示一个窗口
Set objWindow = window.Open("about:blank","ProgressWindow","height=15,width=250,left=300,top=300,status=no,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no")
With objWindow
.Focus()
.ResizeTo 250,15
.document.body.style.fontFamily = "Helvetica"
.document.body.style.fontSize = "11pt"
.document.writeln "
正在搜索本地文件....".document.title = "请稍侯..."
.document.body.style.backgroundColor = "buttonface"
.document.body.style.borderStyle = "none"
.document.body.style.marginTop = 15
end With
'如果系统并非XP,IE不为6.0版本则退出
strWindowsVer = shell.RegRead _
("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
strIeVer = shell.RegRead _
("HKLM\SOFTWARE\Microsoft\Internet Explorer\Version")
if strWindowsVer <> "Microsoft Windows XP" or _
left(strIeVer,3) <> "6.0" then
intFlag = msgbox("操作系统不是XP或者IE版本低于6.0,是否退出?",1)
if intFlag = 1 then
self.close
else
Began
end if
else
Began
end if
objWindow.Close
End Sub
Sub Began
OptionAdd "bat"
intLeft = (document.parentwindow.screen.availwidth - 800) / 2
intTop = (document.parentwindow.screen.availheight - 600) / 2
window.resizeTo 800,650
window.moveTo intLeft, intTop
end Sub
'*******************************************************************'
'搜索本地脚本
'*******************************************************************'
Sub TestSub
Set objFile = fso.OpenTextFile(objOption.value,1,True)
WinMain.innerText = objFile.ReadAll
end Sub
'*******************************************************************'
'擦屁股
'*******************************************************************'
Sub Window_OnBeforeUnload()
On Error Resume Next
fso.DeleteFile "temp_script.vbs",True
fso.DeleteFile "temp_script.bat",True
Set shell = Nothing
Set fso = Nothing
set oPopup= Nothing
End Sub
'*******************************************************************'
'清空代码
'*******************************************************************'
Sub Clear
WinMain.innerText = ""
'WinMain.innerHTML = ""
end Sub
'*******************************************************************'
'复制到剪贴板
'*******************************************************************'
Sub ClipBoard
window.clipboardData.SetData "text", WinMain.innerHTML
end Sub
* { padding:0; border:0; overflow:hidden; font:16px Arial;}
html,body { height:100%; margin:0;}
#box_2 { height:100%; background:#ccc;}
STYLE="padding:2; overflow:auto;background-color:lightyellow;
width:100%; height:70%;" ID="WinMain" οnkeyup="HelpWindow">
accesskey="x" ONCLICK="OpenFile">
accesskey="r" ONCLICK="RunCode">
accesskey="c" ONCLICK="Clear">
accesskey="s" ONCLICK="SaveFile">
accesskey="a" ONCLICK="ClipBoard">
accesskey="d" ONCLICK="ChangeColor">
accesskey="z" class="noBorder" position: checked>
使用帮助(z)
脚本类型:
VBS脚本BAT脚本
代码打包下载
文章浏览阅读699次。已知:负数不可以有阶乘,0的阶乘结果是1,接收用户输入的数字,计算该数字的阶乘结果。_1.编写一个javaweb程序计算一个整数的阶乘,并显示出结果。用户先通过第一个页面e
文章浏览阅读188次。文章目录Chapter 4 查找和引用数据的高手LOOKUP函数,查询中的王者INDIRECT函数,将文本转为引用OFFSET函数,求符合条件的区域Chapter 4 查找和引用数据的高手LOOKUP函数,查询中的王者LOOKUP函数,与MATCH函数,第3参数为“1”类似= MATCH(A2,C2:C9,1) 参数1代表函数将查找小于等于查找值的最大值,并返回该数值在查找区域的..._function中单元格引用
文章浏览阅读192次。1081 子段求和题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1081题目给出一个长度为N的数组,进行Q次查询,查询从第i个元素开始长度为l的子段所有元素之和。例如,1 3 7 9 -1,查询第2个元素开始长度为3的子段和,1 {3 7 9} -1。3 + 7 + 9 = 19,输出19_51nod 1081
文章浏览阅读319次。https://ftp.gnu.org/gnu/gdb/ 下载gdb-11.2.tar.gz,版本最好同local交叉编译器的对齐。2.拷贝install目录下的bin/gdb和test以及main.c拷贝到u盘。1.板子上运行gdbserver指定端口12345。3.gdb server会显示已经连接。4.server gdb开始debug。2.服务器上运行gdb。_交叉编译gdb 和 gdb server 教程
文章浏览阅读1.3k次。介绍线程的状态与状态间的转换_java thread.sleep占不占用cpu资源
文章浏览阅读657次。一、解读CDH1、CM服务(1)状态(2)Cloudera Management Service实例: 5个进程(3)配置(4)单个服务的配置服务: HDFS Kafka角色/实例: 所属的服务的进程以HDFS为例:2、自定义监控图表(1)查询图标库选定一个服务,选择图表库(2)打开图表(3)复制查询语句SELE..._cdh 添加内存监控
文章浏览阅读195次。第一章1.1 数据库介绍数据库的介绍数据库就是存储和管理数据的仓库,数据按照- -定的格式进行存储,用户可以对数据库中的数据进行增加、修改、删除、查询等操作。数据库的分类●关系型数据库●非关系型数据库关系型数据库是指采用了关系模型来组织数据的数据库,简单来说,关系模型指的就是二维表格模型,好比Excel文件中的表格,强调使用表格的方式存储数据。非关系型数据库非关系型数据库,又被称为NoSQL (Not Only SQL),意为不仅仅是SQL,对NoSQL最普遍的定义是“非关联型的”,强调_执行sq丨命令insert,int0
文章浏览阅读806次。估计是用了mysql8.0等高版本导致的解决办法在配置URL时加上serverTimezone=UTC比如,用 ? 连接String url="jdbc:mysql://localhost:3306/test?serverTimezone=UTC"; 如果URL用了allowMultiQueries=true,则要用 & 连接String url="jdbc:m..._更新失败:the server time zone value ' й ' is
文章浏览阅读549次。时间限制:1 秒内存限制:32 兆特殊判题:否提交:4649解决:1530题目描述:首先输入一个5 * 5的数组,然后输入一行,这一行有四个数,前两个代表操作类型,后两个数x y代表需操作数据为以x y为左上角的那几个数据。操作类型有四种: 1 2 表示:90度,顺时针,翻转4个数 1 3 表示:90度,顺时针,翻转9个数_q*4矩阵大小写翻转 oj
文章浏览阅读3.4k次。语言: swift, 版本:4.2,XCode:10.1写作时间:2019-02-11Scheme打开App以前用Scheme方式打开app用类似于 taobao:// 这种方式,配置如下:验证:在Safari输入链接:zscheme:// 就可以打开appAlert提示host的内容, 在 AppDelegate.swift 添加如下代码:func application(_ a..._application(_ app: uiapplication, open url: ur
文章浏览阅读8.5w次,点赞80次,收藏480次。为什么需要数据仓库? 传统的数据库中,存放的数据都是一些定制性数据较多,表是二维的,一张表可以有很多字段,字段一字排开,对应的数据就一行一行写入表中,特点就是利用二维表表现多维关系。 但这种表现关系的上限和下限就定死了,比如QQ的用户信息,直接通过查询info表,对应的username、introduce等信息即可,而此时我想知道这个用户在哪个时间段购买了什么?修改..._数据仓库
文章浏览阅读61次。转:http://www.php7.site/tw/book/php7/23.html#4_php7 关于对象的新特性