Advertisement
andrewb

makeIndex.hta

May 17th, 2019
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <html>
  3.     <head>            
  4.     <HTA:APPLICATION
  5.         ID="makeIndex"
  6.         APPLICATIONNAME="makeIndex"
  7.         SCROLL="no"
  8.         SINGLEINSTANCE="yes"
  9.         WINDOWSTATE="normal"
  10.         MAXIMIZEBUTTON="no"
  11.         BORDER="thin"
  12.         DEBUG="true" />
  13.     <title>Make Index</title>
  14.     <script language="VBScript">
  15. '<![CDATA[
  16.  
  17. ' EVENTS
  18. ' Sets up the window and other parameters when loaded
  19. Sub window_onload()
  20.     ' Resizes the window
  21.    window.resizeTo 420, 380
  22. End Sub
  23.  
  24. Sub ErrorMsg(errmsg)
  25.     MsgBox("ERROR: " + errmsg)
  26. End Sub
  27.  
  28. Sub btnGetFiles_onClick()
  29.     Dim FSO, FLD, FIL, LINKS
  30.     If txtPath.Value <> "" Then
  31.         Set FSO = CreateObject("Scripting.FileSystemObject")
  32.         Set FLD = FSO.GetFolder(txtPath.value)
  33.         LINKS = "<html><body><p>Files:</p>" + vbCrLf
  34.         For Each FIL In FLD.Files
  35.             LINKS = LINKS + "<a href=""" + FIL.Name+ """>" + FIL.Name + "</a><br>" + vbCrLf
  36.         Next
  37.         LINKS = LINKS + "</body></html>"
  38.         txtHtml.Value = LINKS
  39.         txtFileName.Value = txtPath.Value + "\index.html"
  40.     End If
  41. End Sub
  42.  
  43. Sub btnSaveFile_onClick()
  44.     Dim FSO, OTF
  45.     If txtFileName.Value <> "" Then
  46.         Set FSO = CreateObject("Scripting.FileSystemObject")
  47.         Set OTF = FSO.CreateTextFile(txtFileName.Value, True)
  48.         OTF.WriteLine(txtHtml.Value)
  49.         OTF.Close
  50.     End If
  51. End Sub
  52.  
  53. ']]>
  54.    </script>
  55.     <style type="text/css">
  56.  
  57. body { background: #e0e0e0; }
  58.  
  59. div { margin: 5px; }
  60.  
  61.     </style>
  62.     </head>
  63.     <body style="margin: 0px; padding: 0px;">
  64.         <div>
  65.             <input type="text" id="txtPath" style="width: 335px;" />
  66.             <input type="button" id="btnGetFiles" value="Go" style="width: 35px;" />
  67.         </div>
  68.         <div>
  69.             <textarea id="txtHtml" style="width:375px;height:250px;"></textarea>
  70.         </div>
  71.         <div>
  72.             <input type="text" id="txtFileName" style="width: 325px;" />
  73.             <input type="button" id="btnSaveFile" value="Save" style="width: 45px;" />
  74.         </div>
  75.     </body>
  76. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement