- ·上一篇文章:建立在msconfig中不显示的开机启动项
- ·下一篇文章:Windows 脚本文件 (.wsf)
- ·百度中搜索更多的关于“文本代码管理工具”相关内容
- ·谷歌中搜索更多的关于“文本代码管理工具”相关内容
- ******申明******
- 本站文章内容有部分为收录网络中其他网友内容,DOS资源站不保证所有的代码都适合你使用。
- 由于编辑匆忙,有可能造成某些脚本文件出现丢失代码或代码无法运行的情况,请网友根据情况自行修改。
- 如果能将出错部分反馈给我,那就更好了。
文本代码管理工具
今天在网上无意逛到的,识货的另存为文本代码管理工具.hta其中很多VBS代码值得学习,作者都标注说明了
CODE: [Copy to clipboard]
--------------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>笨狼代码大管家-DOS资源站-www.cmdos.net</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
body
{
font-size:12;
BACKGROUND: #DADADA;
margin-left:5;
overflow:visible;
}
.folder
{
font-size:18;
cursor:hand;
}
.folderIcon
{
color:navy;
font-family:wingdings;
font-size:18;
cursor:hand;
}
.file
{
color:navy;
font-size:18;
cursor:hand;
height:21;
}
.fileIcon
{
color:navy;
font-family:wingdings;
font-size:18;
cursor:hand;
height:21;
display:inline;
}
input
{
width:20;
overflow:visible;
border:1px solid lightblue;
background-color:#cccccc;
cursor:text;
}
button
{
border:1px solid gray;
width:60;
margin-left:2;
cursor:hand;
font-size:12;
filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#eaeaff', endColorStr='#618fff', gradientType='0');
}
textarea
{
font-family:Verdana;
font-size:12px;
overflow-x:visible;
overflow-y:scroll;
margin-left:40;
}
#frmTree
{
WIDTH:200px;
height:630;
MARGIN: 0px;
PADDING: 0px;
overflow:scroll;
overflow-x:scroll;
MARGIN-right:10;
}
#frmSeach
{
WIDTH:200px;
height:630;
MARGIN: 0px;
PADDING: 0px;
overflow:scroll;
MARGIN-right:10;
}
#hide_control
{
POSITION: absolute;
LEFT:213px;
TOP:43px;
WIDTH:10px;
height:630;
BACKGROUND: #DADADA;
padding-top:300;
cursor:e-resize;
border:1 solid gray;
z-index:100;
}
#frmTop
{
width:100%;
height:20;
}
#txtFrm
{
POSITION: absolute;
LEFT:230px;
TOP:50px;
WIDTH:100%;
MARGIN-left: -20px;
PADDING: 0px;
BACKGROUND: #DADADA;
}
#txtRead
{
display:none;
position:absolute;
color:red;
font-size:18 px;
top:0;
left:0;
background-color:black;
z-index:1000;
}
#tab1
{
border:1 solid ;
cursor:hand;
}
#tab2
{
border:1 solid ;
cursor:hand;
BACKGROUND: gray;
margin-right:200;
}
</style>
</HEAD>
<BODY onselectstart="vbs:selectControl" onkeydown="vbs:shortCut">
<div id="frmTop">
<span id="tab1" onclick="vbs:showMe me"> 目 录 </span>
<span id="tab2" onclick="vbs:showMe me" > 搜 索 </span>
标题:<input id="articleTitle" style="width:100" readonly/>
<button id="browse" onclick="vbs:browseMe" >预览</button>
<button id="saveButton" onclick="vbs:saveFile" >保存</button>
<button id="browse" onclick="vbs:createFile" >新建</button>
<button id="format" onclick="vbs:formatXML">格式化XML</button>
<button id="test" onclick="vbs:read">阅读模式</button>
<button id="test" onclick="vbs:showHelp">说明</button>
行 <span id="Ln">1</span><hr/>
</div>
<div id="frmTree" onclick="vbs:f_Click" onkeydown="vbs:deletFile" >
<div id="tree" style='margin-left:0;color:navy;font-size:12;cursor:hand;' ></div>
</div>
<div id="frmSeach" onclick="vbs:f_Click" >
<hr/>
<div id="list" style='margin-left:0' onkeydown="deletFile">
<input id="searchKey" style="width:100" onkeypress="vbs:searchPress"/>
<button onclick="vbs:seachFile" id="searchButton">查找</button><br/>
<div id="seachList" style='margin-left:0' >搜索结果</div>
</div>
</div>
<input type="button" id="hide_control" onmousedown="vbs:beginDrag" onmouseup="vbs:upHandler" bgcolor="#eeeeee"/>
<div valign="top" id="txtFrm">
<textarea id="txt" 定义本文件夹路径
thisFileDir = replace(window.location.href,"file:///","")
thisFileDir = unescape(replace(thisFileDir,"/","\"))
thisFileName = LastOne(thisFileDir,"\")
thisFileFolder=getFolderDir(thisFileDir)
tree.title = thisFileFolder
dim currentDir'当前路径
dim currentFile'当前文件
dim currentDiv'当前DIV对象
dim currentSpan'当前Span对象
dim delatX
dim dragAble:dragAble = false
dim Dtitle
Dtitle=document.title
currentDir = thisFileFolder
set currentDiv = tree
tree.innerText = getTxtName(thisFileName)
showMe tab1
showFolder tree
sub read
txtRead.style.display="block"
txtRead.style.border="1px solid red"
HTML="<marquee id= SCROLLAMOUNT='4' SCROLLDELAY='1' direction='up' height=' " & window.screen.availHeight-80 & "'>"
HTML= HTML & "<xmp style='word-wrap:break-word;line-height:60px ;' >" & txt.value & "</xmp></marquee>"
ifrm.document.body.innerHTML= HTML
ifrm.document.body.style.backgroundColor = "#000000"
ifrm.document.body.style.fontSize="40"
ifrm.document.body.style.color="red"
ifrm.document.body.style.textDecoration="underline"
set marquee=ifrm.document.body.getElementsByTagName("marquee")(0)
marquee.onmousemove=getRef("setMarquee")
end sub
sub setMarquee
set m=ifrm.document.body.getElementsByTagName("marquee")(0)
pos= ifrm.window.event.clientY
total= ifrm.window.screen.availHeight
if not isnumeric(pos) then exit sub
if pos >total*2/5 and pos< total*3/5 then
m.stop
else
m.start
end if
if pos< total*2/5 then
m.direction="down"
else
m.direction="up"
end if
if pos >total/5 and pos< total*4/5 then
m.scrollAmount=1
else
m.scrollAmount=int(abs((pos-total/2)/20-8))
end if
end sub
sub closeRead
txtRead.style.display="none"
end sub
sub showLn
Ln.innerText = cint((window.event.offsetY-2)/15)+1
end sub
sub txt_onscroll
frmTop.scrollIntoView
end sub
sub formatXML()
set doc = createobject("MSXML2.DOMDocument")
if doc.loadXML(txt.value) then
Dim rdr, wrt
set wrt = createobject("MSXML2.MXXMLWriter")
set rdr = createobject("MSXML2.SAXXMLReader")
wrt.indent = True
Set rdr.contentHandler = wrt
rdr.parse(txt.value)
txt.value = wrt.output
else
alert("XML格式不正确,请确保Well-Formed!")
end if
end sub
sub shortCut
if window.event.keyCode=83 and window.event.ctrlKey then
if currentFile<>"" then saveFile
window.event.cancelBubble = true
window.event.returnValue = false
end if
if window.event.keyCode=66 and window.event.ctrlKey then
browseMe
window.event.cancelBubble = true
window.event.returnValue = false
end if
if window.event.keyCode=78 and window.event.ctrlKey then
createFile
window.event.cancelBubble = true
window.event.returnValue = false
end if
end sub
sub browseMe
dim win
set win=window.open(currentFile)
'win.document.write txt.value
end sub
sub createFile
'点创建按钮,真的创建了.
if vartype(currentSpan)<>0 then currentSpan.style.color = "navy"
if currentDir ="" then
'如果点到了文件
currentDir=getFolderDir(currentFile)
else
'点到了文件夹
dim n
set n=currentDiv.nextSibling
do
if vartype(n) =9 then exit do
if left(n.title,len(currentDir)) <> currentDir then exit do
set currentDiv =n
set n=n.nextSibling
loop
end if
dim re,newFile,s,f
set re = new RegExp
re.Pattern = "[^\d]"
re.Global=true
newFile = currentDir & "新收藏" & re.Replace(mid(cstr(now()),3),"") & ".txt"
currentFile=newFile'新建文件是当前文件
'构造innerHTML
s = "<div class='file' title='" & newFile
s = s & "' style='margin-left:"
if currentDiv.className = "file" then
s = s & currentDiv.style.marginLeft & ";' > "
else
s = s & px2Int(currentDiv.style.marginLeft) + 8 & ";' > "
end if
s = s & "<span class='fileIcon'>2" & "</span>"
s = s & "<input value='"
s = s & getTxtName(lastOne(newFile,"\")) & "' title='" & getTxtName(lastOne(newFile,"\")) & "' >"
seachResult = seachResult & "</div>"
exit do
end if
Loop
st.Close
end if
end if
next
set fd = fso.GetFolder(theFolder)
for each fd1 in fd.SubFolders
seachWord fd1
next
end sub
sub showHelp
dim msg,f,re,version
set f=fso.GetFile(thisFileDir)
version = f.DateLastModified
set re = new RegExp
re.Pattern = "[^\d]"
re.Global=true
version = re.Replace(mid(cstr(version),3),"/")
version = left(version ,len(version)-3)
set re = nothing
msg = " 文本代码管理工具【IE5.5以上版本】" & vbcrlf
msg = msg & "------------------------------------------------" & vbcrlf
msg = msg & " 使用方法:放到文本类型的文件夹里面,双击运行。" & vbcrlf
msg = msg & "功能:" & vbcrlf
msg = msg & "1,快速浏览,预览CTRL+B,搜索文本类型的文件和代码;" & vbcrlf
msg = msg & "2,按DEL可以删除点中的文件和文件夹;" & vbcrlf
msg = msg & "3,可以修改文件名和文字内容,CTRL+S保存;" & vbcrlf
msg = msg & "4,可以创建文件CTRL+N并且编辑保存;" & vbcrlf
msg = msg & "5,文本编辑支持TAB和shift+TAB键;" & vbcrlf
msg = msg & "6,格式化Well-Formed的XML文件;" & vbcrlf
msg = msg & vbcrlf
msg = msg & "作者:CSDN超级大笨狼[" & version & "版本]请随时到网站检查最新版本" & vbcrlf
msg = msg & "欢迎传播使用,交流代码panyuguang962@hotmail.com" & vbcrlf
msg = msg & "http://superdullwolf.cnzone.net/index.asp" & vbcrlf
alert msg
end sub
</SCRIPT>
</BODY>
</HTML>

