Board logo

标题: 笨狼代码大管家.hta [打印本页]

作者: fastslz    时间: 2011-9-7 12:46     标题: 笨狼代码大管家.hta

另存为“笨狼代码大管家.hta”
用于查看、整理、修改、阅读各类脚本代码工具
  1. <HTML>
  2. <HEAD>
  3. <TITLE>笨狼代码大管家</TITLE>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  5. <style>
  6. body
  7. {
  8. font-size:12;
  9. BACKGROUND: #DADADA;
  10. margin-left:5;
  11. overflow:visible;
  12. }
  13. .folder
  14. {
  15. font-size:18;
  16. cursor:hand;
  17. }
  18. .folderIcon
  19. {
  20. color:navy;
  21. font-family:wingdings;
  22. font-size:18;
  23. cursor:hand;
  24. }
  25. .file
  26. {
  27. color:navy;
  28. font-size:18;
  29. cursor:hand;
  30. height:21;
  31. }
  32. .fileIcon
  33. {
  34. color:navy;
  35. font-family:wingdings;
  36. font-size:18;
  37. cursor:hand;
  38. height:21;
  39. display:inline;
  40. }
  41. input
  42. {
  43. width:20;
  44. overflow:visible;
  45. border:1px solid lightblue;
  46. background-color:#cccccc;
  47. cursor:text;
  48. }
  49. button
  50. {
  51. border:1px solid  gray;
  52. width:60;
  53. margin-left:2;
  54. cursor:hand;
  55. font-size:12;
  56. filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#eaeaff', endColorStr='#618fff', gradientType='0');
  57. }
  58. textarea
  59. {
  60. font-family:Verdana;
  61. font-size:12px;
  62. overflow-x:visible;
  63. overflow-y:scroll;
  64.                 margin-left:40;            
  65. }
  66. #frmTree
  67. {
  68. WIDTH:200px;
  69. height:630;
  70. MARGIN: 0px;
  71. PADDING: 0px;
  72. overflow:scroll;
  73. overflow-x:scroll;
  74. MARGIN-right:10;
  75. }
  76. #frmSeach
  77. {
  78. WIDTH:200px;
  79. height:630;
  80. MARGIN: 0px;
  81. PADDING: 0px;
  82. overflow:scroll;
  83. MARGIN-right:10;
  84. }
  85. #hide_control
  86. {
  87. POSITION: absolute;
  88. LEFT:213px;
  89. TOP:43px;
  90. WIDTH:10px;
  91. height:630;
  92. BACKGROUND: #DADADA;
  93. padding-top:300;
  94. cursor:e-resize;
  95. border:1 solid gray;
  96. z-index:100;
  97. }
  98. #frmTop
  99. {
  100. width:100%;
  101. height:20;
  102. }
  103. #txtFrm
  104. {
  105. POSITION: absolute;
  106. LEFT:230px;
  107. TOP:50px;
  108. WIDTH:100%;
  109. MARGIN-left: -20px;
  110. PADDING: 0px;
  111. BACKGROUND: #DADADA;
  112. }
  113. #txtRead
  114. {
  115. display:none;
  116. position:absolute;
  117. color:red;
  118. font-size:18 px;
  119. top:0;
  120. left:0;
  121. background-color:black;
  122. z-index:1000;
  123. }
  124. #tab1
  125. {
  126. border:1 solid  ;
  127. cursor:hand;
  128. }
  129.   #tab2
  130. {
  131. border:1 solid  ;
  132. cursor:hand;
  133. BACKGROUND: gray;
  134. margin-right:200;
  135. }
  136. </style>
  137. </HEAD>
  138. <BODY onselectstart="vbs:selectControl" onkeydown="vbs:shortCut">
  139. <div id="frmTop">
  140. <span id="tab1" onclick="vbs:showMe me"> &nbsp;目 录 </span>
  141. <span id="tab2" onclick="vbs:showMe me" > &nbsp;搜 索 </span>
  142. 标题:<input id="articleTitle" style="width:100" readonly/>
  143. <button id="browse" onclick="vbs:browseMe" >预览</button>
  144. <button id="saveButton" onclick="vbs:saveFile" >保存</button>
  145. <button id="browse" onclick="vbs:createFile" >新建</button>
  146. <button id="format" onclick="vbs:formatXML">格式化XML</button>
  147. <button id="test" onclick="vbs:read">阅读模式</button>
  148. <button id="test" onclick="vbs:showHelp">说明</button>
  149. 行&nbsp;<span id="Ln">1</span><hr/>
  150. </div>
  151. <div  id="frmTree" onclick="vbs:f_Click" onkeydown="vbs:deletFile" >
  152. <div id="tree" style='margin-left:0;color:navy;font-size:12;cursor:hand;' ></div>
  153. </div>
  154. <div  id="frmSeach" onclick="vbs:f_Click" >
  155. <hr/>
  156. <div id="list" style='margin-left:0' onkeydown="deletFile">
  157. <input id="searchKey" style="width:100" onkeypress="vbs:searchPress"/>
  158. <button onclick="vbs:seachFile" id="searchButton">查找</button><br/>
  159. <div id="seachList" style='margin-left:0' >搜索结果</div>
  160. </div>
  161. </div>
  162. <input type="button"  id="hide_control" onmousedown="vbs:beginDrag" onmouseup="vbs:upHandler"  bgcolor="#eeeeee"/>
  163. <div valign="top" id="txtFrm">
  164. <textarea id="txt"   onkeydown='vbs:TabTxt' onclick="vbs:showLn"  ></textarea>
  165. </div>
  166. <div valign="top" id="txtRead" >
  167. <button  onclick='vbs:closeRead' >关闭</button>
  168. <br/>
  169. <iframe id='ifrm' frameborder=0 width="101%"  height="1000" SCROLLING="no" ></iframe>
  170. </div>
  171. <SCRIPT LANGUAGE="vbscript">
  172. '**************************
  173. '*****超级大笨狼***********
  174. '**************************
  175. on error resume next
  176. window.resizeTo window.screen.availWidth,window.screen.availHeight
  177. window.moveTo 0,0
  178. frmTree.style.height = cint(window.screen.availHeight )-70
  179. hide_control.style.height = cint(window.screen.availHeight * 0.98)+5
  180. txt.style.height = cint(window.screen.availHeight )-70
  181. txt.style.width = cint(window.screen.availWidth - 250)
  182. 'txt.style.width = window.screen.availWidth - px2Int(txtFrm.style.left) -20
  183. Set fso = CreateObject("Scripting.FileSystemObject")
  184. dim thisFileDir'定义本文件绝对路径
  185. dim thisFileName'定义本文件名
  186. dim thisFileFolder'定义本文件夹路径
  187. thisFileDir = replace(window.location.href,"file:///","")
  188. thisFileDir = unescape(replace(thisFileDir,"/","\"))
  189. thisFileName = LastOne(thisFileDir,"\")
  190. thisFileFolder=getFolderDir(thisFileDir)
  191. tree.title = thisFileFolder
  192. dim currentDir'当前路径
  193. dim currentFile'当前文件
  194. dim currentDiv'当前DIV对象
  195. dim currentSpan'当前Span对象
  196. dim delatX
  197. dim dragAble:dragAble = false
  198. dim Dtitle
  199. Dtitle=document.title
  200. currentDir = thisFileFolder
  201. set currentDiv = tree
  202. tree.innerText =  getTxtName(thisFileName)
  203. showMe tab1
  204. showFolder tree
  205. sub read
  206. txtRead.style.display="block"
  207. txtRead.style.border="1px solid red"
  208.    
  209. HTML="<marquee id= SCROLLAMOUNT='4' SCROLLDELAY='1'  direction='up' height=' " & window.screen.availHeight-80  & "'>"
  210. HTML=  HTML & "<xmp style='word-wrap:break-word;line-height:60px ;' >" &  txt.value & "</xmp></marquee>"  
  211. ifrm.document.body.innerHTML= HTML
  212. ifrm.document.body.style.backgroundColor = "#000000"
  213. ifrm.document.body.style.fontSize="40"
  214. ifrm.document.body.style.color="red"
  215. ifrm.document.body.style.textDecoration="underline"
  216. set marquee=ifrm.document.body.getElementsByTagName("marquee")(0)
  217. marquee.onmousemove=getRef("setMarquee")
  218. end sub
  219. sub setMarquee
  220. set m=ifrm.document.body.getElementsByTagName("marquee")(0)
  221. pos=  ifrm.window.event.clientY
  222. total=  ifrm.window.screen.availHeight
  223. if not isnumeric(pos) then exit sub
  224. if pos >total*2/5  and pos< total*3/5 then
  225. m.stop  
  226. else
  227. m.start
  228. end if
  229. if  pos< total*2/5 then
  230. m.direction="down"   
  231. else
  232. m.direction="up"
  233. end if
  234. if  pos >total/5  and pos< total*4/5 then
  235. m.scrollAmount=1
  236. else
  237. m.scrollAmount=int(abs((pos-total/2)/20-8))
  238. end if
  239. end sub
  240. sub closeRead
  241. txtRead.style.display="none"
  242. end sub
  243. sub showLn
  244. Ln.innerText = cint((window.event.offsetY-2)/15)+1
  245. end sub
  246. sub txt_onscroll
  247. frmTop.scrollIntoView
  248. end sub
  249. sub formatXML()
  250. set doc = createobject("MSXML2.DOMDocument")
  251. if doc.loadXML(txt.value) then
  252. Dim rdr, wrt
  253. set wrt = createobject("MSXML2.MXXMLWriter")
  254. set rdr = createobject("MSXML2.SAXXMLReader")
  255. wrt.indent = True
  256. Set rdr.contentHandler = wrt
  257. rdr.parse(txt.value)
  258. txt.value = wrt.output
  259. else
  260. alert("XML格式不正确,请确保Well-Formed!")
  261. end if
  262. end sub
  263. sub shortCut
  264.    
  265. if window.event.keyCode=83 and window.event.ctrlKey  then
  266. if currentFile<>"" then saveFile
  267. window.event.cancelBubble = true
  268. window.event.returnValue = false
  269. end if
  270. if window.event.keyCode=66 and window.event.ctrlKey  then
  271. browseMe
  272. window.event.cancelBubble = true
  273. window.event.returnValue = false
  274. end if
  275. if window.event.keyCode=78 and window.event.ctrlKey  then
  276. createFile
  277. window.event.cancelBubble = true
  278. window.event.returnValue = false
  279. end if
  280. end sub
  281. sub browseMe
  282. dim win
  283. set win=window.open(currentFile)
  284. 'win.document.write txt.value
  285. end sub
  286. sub createFile
  287. '点创建按钮,真的创建了.
  288. if vartype(currentSpan)<>0 then currentSpan.style.color = "navy"
  289. if currentDir ="" then
  290. '如果点到了文件
  291. currentDir=getFolderDir(currentFile)
  292. else
  293. '点到了文件夹
  294. dim n
  295. set n=currentDiv.nextSibling
  296. do
  297. if vartype(n) =9 then  exit do
  298. if left(n.title,len(currentDir)) <> currentDir then exit do
  299. set  currentDiv =n
  300. set n=n.nextSibling
  301. loop
  302. end if
  303. dim re,newFile,s,f
  304. set re = new RegExp
  305. re.Pattern = "[^\d]"
  306. re.Global=true
  307. newFile = currentDir & "新收藏" & re.Replace(mid(cstr(now()),3),"") & ".txt"
  308. currentFile=newFile'新建文件是当前文件
  309. '构造innerHTML
  310. s =  "<div class='file' title='" & newFile   
  311. s = s & "' style='margin-left:"
  312. if currentDiv.className = "file" then
  313. s = s  &  currentDiv.style.marginLeft & ";' >&nbsp;"
  314. else
  315. s = s  &  px2Int(currentDiv.style.marginLeft) + 8 & ";' >&nbsp;"
  316. end if
  317. s = s  &  "<span class='fileIcon'>2" & "</span>"
  318. s = s  &  "<input value='"
  319. s = s &  getTxtName(lastOne(newFile,"\")) & "' title='" & getTxtName(lastOne(newFile,"\")) & "' onchange='vbs:reName me' />"
  320. s = s & "</div>"
  321. '插入innerHTML
  322. currentDiv.insertAdjacentHTML "AfterEnd",s
  323. articleTitle.value = getTxtName(lastOne(newFile,"\"))
  324. txt.value = ""
  325. currentDir = ""
  326. set currentDiv = currentDiv.nextSibling
  327. set currentSpan = currentDiv.getElementsByTagName("SPAN")(0)
  328. currentSpan.style.color = "red"
  329. '创建文件
  330. set f=fso.CreateTextFile(newFile)
  331. f.close
  332. end sub
  333. function getFolderDir(fullDir)
  334. '输入得到全路径,得到文件夹路径
  335. s=LastOne(fullDir,"\")
  336. getFolderDir = left(fullDir,len(fullDir)-len(s))
  337. end function
  338. sub saveFile
  339. '保存对文件的修改
  340.    Dim  f, st
  341.    set f= fso.GetFile(currentFile)  
  342.    If f.attributes and 1 Then
  343. if window.confirm("该文件属性为只读,是否改变其属性并保存修改?") then f.attributes = f.attributes - 1
  344. end if
  345.    Set st = fso.OpenTextFile(currentFile, 2, True)   
  346.    
  347.    st.Write txt.value
  348.    st.close
  349. end sub
  350. sub deletFile
  351. '删除文件
  352. dim  n
  353. if window.event.keyCode =46 and window.event.srcElement.tagName<>"INPUT"  then
  354. if currentFile<>""  then
  355. if currentFile = thisFileDir   then
  356. alert "不允许删除本文件!"
  357. exit sub
  358. end if
  359. if fso.FileExists(currentFile)  then
  360. fso.deletefile currentFile,true
  361. currentDiv.parentElement.removeChild currentDiv
  362. txt.value = ""
  363. currentFile = ""
  364. articleTitle.value = ""
  365. end if
  366. end if
  367. if currentDir<>""   then
  368. if currentDir = thisFileFolder   then
  369. alert "不允许删除根目录!"
  370. exit sub
  371. end if
  372. set n = currentDiv.nextSibling
  373. if window.confirm( currentDir & vbcrlf & "这个文件夹有子文件,你要删除全部子文件吗?") then
  374. do
  375. if vartype(n) =9 then  exit do  
  376. if px2Int(n.style.marginLeft) <= px2Int(currentDiv.style.marginLeft)   then exit do
  377. n.parentElement.removeChild n
  378. set n=currentDiv.nextSibling
  379. loop
  380. if  fso.FolderExists(currentDir)  then fso.DeleteFolder left(currentDir,len(currentDir)-1)
  381. currentDiv.parentElement.removeChild currentDiv
  382. end if
  383. end if
  384. end if
  385. end sub
  386. sub showMe(obj)
  387. if obj.id ="tab1" then
  388. tab2.style.backgroundColor="gray"
  389. tab1.style.backgroundColor="#DADADA"
  390. frmSeach.style.display="none"  
  391. frmTree.style.display=""
  392. else
  393. tab1.style.backgroundColor="gray"
  394. tab2.style.backgroundColor="#DADADA"
  395. frmSeach.style.display=""
  396. frmTree.style.display="none"  
  397. end if
  398. end sub
  399. sub beginDrag
  400. '开始拖拽
  401. delatX=window.event.clientX - px2Int(hide_control.currentStyle.left)
  402. document.attachEvent "onmousemove",getRef("moveHandler")
  403. dragAble = true
  404. window.event.cancelBubble = true
  405. end sub
  406. sub moveHandler
  407. '移动绑定事件
  408. if not dragAble then exit sub
  409. dim x
  410. x = window.event.clientX - delatX
  411. hide_control.style.left= x & "px"
  412. txtFrm.style.left=( x + 20) & "px"
  413. txt.style.width = window.screen.availWidth - px2Int(txtFrm.style.left) -20
  414. window.event.cancelBubble=true
  415. end sub
  416. sub upHandler
  417. '放开绑定事件
  418. document.detachEvent "onmousemove",getRef("moveHandler")
  419. dim x
  420. x = window.event.clientX - delatX
  421. if px2Int(hide_control.style.left)>205 then
  422. frmTree.style.width = abs( px2Int(hide_control.style.left)-10) & "px"
  423. frmSeach.style.width = abs( px2Int(hide_control.style.left)-10) & "px"
  424. else
  425. frmTree.style.width = "200px"
  426. frmSeach.style.width = "200px"
  427. end if
  428. dragAble = false
  429. window.event.cancelBubble=true
  430. end sub
  431. function getTxtName(fullName)
  432. '去掉文件名后缀
  433. dim s:s=lastOne(fullName,".")
  434. getTxtName = left(fullName ,len(fullName)-len(s)-1)
  435. end function
  436. sub reName(obj)
  437. '改名
  438. dim Arr,a
  439. Arr=array("/","\",":","*","?",chr(34),"|","<",">")
  440. for each a in Arr
  441. if instr(obj.value,a) >0 then
  442. alert "命名不能含有/\:*?" & chr(34) &  "|<>其中的一个"
  443. obj.focus
  444. exit sub
  445. end if
  446. next
  447. dim oldName,newName,oldPath,oldType
  448. oldName = obj.parentElement.title
  449. oldPath = getFolderDir(oldName)
  450. oldType = lastOne(oldName,".")
  451. newName = oldPath & obj.value & "." & oldType
  452. Set f = fso.GetFile(oldName)
  453. f.copy newName
  454.                 currentFile = newName
  455. f.delete True
  456. obj.parentElement.title = newName
  457. articleTitle.value = getTxtName(lastOne(newName,"\"))
  458. end sub
  459. Function LastOne(Str,splitStr)
  460. '输入字符和分隔符,得到最后一部分
  461. LastOne = right(Str,len(Str)-InStrRev(Str,splitStr))
  462. End Function
  463. sub  selectControl
  464. '控制页面选择的状态
  465. if window.event.srcElement.tagName<>"INPUT" and window.event.srcElement.tagName<>"TEXTAREA"  then
  466. document.selection.clear
  467. end if
  468. end sub
  469. function isTXT(fileNameStr)
  470. '判断是否是文本类型的文件
  471. dim s,Arr,a,returnValue
  472. returnValue = false
  473. s=lcase(LastOne(fileNameStr,"."))
  474. Arr=array("txt","sql","htm","html","asp","csv","aspx","xml","js","vbs","ini","bat","css","htc","hta","xsl","xslt","lrc","vb","cs","cx","asa","aspx","asax","config","shtml","stm","cpp","c","cxx","h","hpp","rc","pl","pm","cgi","php3","php","java","jsp","tpl","wsh","sgf","xsd","udl","asmx","inc","cmd")
  475. for each a in Arr
  476. if a=s then
  477. returnValue =true
  478. exit for
  479. end if
  480. next
  481. isTXT = returnValue
  482. end function
  483. sub showFolder(obj)
  484.     dim  folderspec :folderspec = obj.title
  485.     obj.setAttribute "parsed",true    
  486. if not fso.FolderExists(folderspec) then
  487. alert folderspec & "该文件夹不存在,也许是被移动了,所以刷新一下本程序"
  488. window.location.reload
  489. exit sub
  490. end if
  491. dim f, f1, sf,sf1,i,s,fName
  492. set f=fso.GetFolder(folderspec)        
  493. set sf=f.Subfolders
  494. re = re &   f.name & "\"   
  495. s=""           
  496. for each sf1 in sf
  497. s =  s & "<div class='folder' title='" & sf1.path & "\' style='margin-left:" & cint(replace(obj.style.marginLeft,"px","")) + 8 & ";'>"
  498. s =  s & "<span class='folderIcon'>0" & "</span><input value='" & sf1.name & "' readonly style='cursor:hand;'/></div>"         
  499. next
  500. For Each f1 in f.Files
  501. if isTXT(f1.name)  then   
  502. s =  s & "<div class='file' title='" &  f1.path   
  503. s = s & "' style='margin-left:"
  504. s = s  &  px2Int(obj.style.marginLeft) + 8 & ";' >&nbsp;"
  505. s = s  &  "<span class='fileIcon'>2" & "</span>"
  506. s = s  &  "<input value='"
  507. fName = getTxtName(f1.name)
  508. s = s & fName & "' title='" & fName & "' onchange='vbs:reName me' />"
  509. s = s & "</div>"
  510. end if
  511. Next
  512. obj.insertAdjacentHTML "AfterEnd",s
  513. end sub
  514. function px2Int(px)
  515. px2Int = cint(replace(px,"px",""))
  516. end function
  517. sub f_Click()
  518. dim obj,d,f,state
  519. set obj = window.event.srcElement
  520. if obj.id="searchKey" then exit sub
  521. if  obj.tagName<>"SPAN" and obj.tagName<>"INPUT"  then exit sub
  522. set currentDiv = obj.parentElement
  523. set obj = currentDiv.getElementsByTagName("SPAN")(0)
  524. window.event.cancelBubble = true
  525. select case obj.className
  526. case  "folderIcon"  
  527. '点到了文件夹
  528. if vartype(currentSpan)=8 then
  529. currentSpan.style.color = "navy"
  530. end if
  531. set currentSpan = obj
  532. state = abs(cint(obj.innerHTML)  -1)
  533. obj.innerHTML = state
  534. obj.style.color="red"
  535. set d = obj.parentElement
  536. currentDir = d.title
  537. currentFile = ""
  538. if d.getAttribute("parsed")=true then
  539. '合拢
  540. fold d,state
  541. else
  542. '解析
  543. showFolder d
  544. end if
  545. case  "fileIcon"  
  546. '点到了文件,在textArea里面载入文本文件
  547. if vartype(currentSpan)=8 then
  548. currentSpan.style.color = "navy"
  549. end if
  550. set currentSpan = obj
  551. obj.style.color="red"
  552. readText obj.parentElement.title
  553. currentDir = ""
  554. currentFile = obj.parentElement.title
  555. end select
  556. end sub
  557. sub fold(o,stateOpen) '合拢
  558. dim n
  559. set n=o.nextSibling
  560. do
  561. if vartype(n) =9 then  exit do
  562. if px2Int(n.style.marginLeft) <= px2Int(o.style.marginLeft)   then exit do   
  563. if stateOpen=1 then n.style.display="" else  n.style.display="none"
  564. set n=n.nextSibling
  565. loop
  566. end sub
  567. sub readText(filePath)  
  568. Dim f,fName
  569. if not fso.FileExists(filePath) then
  570. alert filePath & vbcrlf & "该文件不存在,也许是被移动了,所以刷新一下本程序"
  571. window.location.reload
  572. exit sub
  573. end if
  574. 'TXT已经加载的当前文件不再加载.
  575. if filePath = currentFile then exit sub
  576. txt.value = ""
  577. Set f = fso.OpenTextFile(filePath, 1, true)
  578. if not f.AtEndOfStream  then
  579. txt.value = f.readAll
  580. else
  581. txt.value = ""
  582. end if
  583. fName = lastOne(filePath,"\")
  584. articleTitle.value =  getTxtName(fName)
  585. f.Close
  586. Ln.innerText = 1
  587. End sub
  588. sub TabTxt()
  589. '支持tab键的文本框
  590. if  window.event.keyCode=38  then
  591. if cint(Ln.innerText) >1 then Ln.innerText =  cint(Ln.innerText)-1
  592. end if
  593. if window.event.keyCode=40 then
  594. Ln.innerText =  cint(Ln.innerText)+1
  595. end if
  596. if window.event.keyCode<> 9 then exit sub
  597. dim sel,mytext
  598. set sel = document.selection.createRange()
  599. 'txt.createTextRange
  600. mytext = sel.text
  601. if len(mytext)=0   then
  602. sel.text =string(4," ")
  603. window.event.cancelBubble = true
  604. window.event.returnValue = false
  605. exit sub
  606. end if
  607. dim  t,Arr
  608. t=0
  609. Arr = split(mytext,vbcrlf)
  610. if window.event.shiftKey then
  611. '按sift
  612. for i=0 to ubound(Arr)
  613. if left(Arr(i),1)=vbtab then
  614. Arr(i) = mid(Arr(i),2)
  615. t= t + 1
  616. else
  617. for j=1 to 4
  618. if left(Arr(i),1)=" " then
  619. Arr(i) = mid(Arr(i),2)
  620. t= t + 1
  621. else
  622. exit for
  623. end if
  624. next
  625. end if
  626. next
  627. t= t
  628. else
  629. '不按sift
  630. for i=0 to ubound(Arr)
  631. Arr(i) = vbtab & Arr(i)
  632. t= t +1
  633. next
  634. end if
  635. mytext = join(Arr,vbcrlf)
  636. sel.text = mytext
  637. sel.collapse true
  638. sel.moveEnd "character",0
  639. sel.moveStart "character",(len(mytext) * -1) + t
  640. sel.select()
  641. window.event.cancelBubble = true
  642. window.event.returnValue = false
  643. end sub
  644. '下面是关于搜索
  645. dim  seachResult'查找结果
  646. dim num '结果数量
  647. dim word'搜索关键字
  648. tagStop = false
  649. seachResult =""
  650. '按回车后响应
  651. sub searchPress
  652. if window.event.keyCode=13  then
  653. seachFile
  654. end if
  655. end sub
  656. '显示搜索结果
  657. sub seachFile()
  658. num =0
  659. seachList.innerText = "搜索结果"
  660. word = searchKey.value
  661. seachResult =""
  662. if trim(word)="" then
  663. alert "关键字为空!"
  664. searchKey.focus
  665. exit sub
  666. else
  667. dim l
  668. for each l in list.getElementsByTagName("DIV")
  669. if l.id<>"seachList" then list.removeChild l
  670. next
  671. seachList.innerText = "搜索结果"
  672. seachWord thisFileFolder
  673. seachList.insertAdjacentHTML "AfterEnd",seachResult
  674. seachList.innerText = "搜索结果:" & num & "个"
  675. alert "搜索完毕!"
  676. end if
  677. end sub
  678. sub seachWord(theFolder)
  679. dim f,f1,st,re,fd,fd1
  680. set f = fso.GetFolder(theFolder)
  681. for each f1 in f.Files
  682. if isTxt(f1.path)  then
  683. if instr(f1.path,word)>0 then
  684. seachResult = seachResult & "<div class='file' title='" &  f1.path
  685. seachResult = seachResult & "'><span class='fileIcon'>2" & "</span>"
  686. seachResult = seachResult &  "<input value='"
  687. fName = getTxtName(f1.name)
  688. seachResult = seachResult & fName & "' title='" & fName & "'>"
  689. seachResult = seachResult & "</div>"
  690. num = num + 1
  691. else
  692. set st = f1.OpenAsTextStream
  693. '逐行读
  694. Do While st.AtEndOfStream <> True
  695. if instr(st.ReadLine,word)>0 then
  696. num = num +1
  697. seachResult = seachResult & "<div class='file' title='" &  f1.path
  698. seachResult = seachResult & "'><span class='fileIcon'>2" & "</span>"
  699. seachResult = seachResult &  "<input value='"
  700. fName = getTxtName(f1.name)
  701. seachResult = seachResult & fName & "' title='" & fName & "'>"
  702. seachResult = seachResult & "</div>"
  703. exit do
  704. end if
  705. Loop
  706. st.Close
  707. end if
  708. end if
  709. next
  710. set fd = fso.GetFolder(theFolder)
  711. for each  fd1 in fd.SubFolders
  712. seachWord fd1
  713. next
  714. end sub
  715. sub showHelp
  716. dim msg,f,re,version
  717. set f=fso.GetFile(thisFileDir)
  718. version = f.DateLastModified
  719. set re = new RegExp
  720. re.Pattern = "[^\d]"
  721. re.Global=true
  722. version =  re.Replace(mid(cstr(version),3),"/")
  723.                 version =   left(version ,len(version)-3)
  724. set re = nothing
  725. msg = "  文本代码管理工具【IE5.5以上版本】" & vbcrlf
  726. msg = msg & "------------------------------------------------" & vbcrlf
  727. msg = msg & "  使用方法:放到文本类型的文件夹里面,双击运行。" & vbcrlf
  728. msg = msg & "功能:" & vbcrlf
  729. msg = msg & "1,快速浏览,预览CTRL+B,搜索文本类型的文件和代码;" & vbcrlf
  730. msg = msg & "2,按DEL可以删除点中的文件和文件夹;" & vbcrlf
  731. msg = msg & "3,可以修改文件名和文字内容,CTRL+S保存;" & vbcrlf
  732. msg = msg & "4,可以创建文件CTRL+N并且编辑保存;" & vbcrlf
  733. msg = msg & "5,文本编辑支持TAB和shift+TAB键;" & vbcrlf
  734. msg = msg & "6,格式化Well-Formed的XML文件;" & vbcrlf
  735. msg = msg &    vbcrlf
  736. msg = msg & "作者:CSDN超级大笨狼[" & version & "版本]请随时到网站检查最新版本" & vbcrlf
  737. msg = msg & "欢迎传播使用,交流代码panyuguang962@hotmail.com" & vbcrlf
  738. msg = msg & "http://superdullwolf.cnzone.net/index.asp" & vbcrlf
  739. alert msg
  740. end sub
  741. </SCRIPT>
  742. </BODY>
  743. </HTML>
复制代码

作者: BillGates    时间: 2011-9-7 13:03

干嘛用的?
作者: wc726842270    时间: 2011-9-7 13:21

真不知要过多少年少有这水平,唉、
原来是在这儿啊
  1. HTML="<marquee id= SCROLLAMOUNT='4' SCROLLDELAY='1'  direction='up' height=' " & window.screen.availHeight-80  & "'>"
  2.          HTML=  HTML & "<xmp style='word-wrap:break-word;line-height:60px ;' >" &  txt.value & "</xmp></marquee>"  
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2