Advertisement
Najeebsk

WRITE-BATCH.vbs

Dec 10th, 2021
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. Dim fso, objWRITE, objREAD, CD, current, create
  3. Const vbRead=1, vbAppend=8
  4. Set fso = CreateObject("Scripting.FileSystemObject")
  5.  
  6. CD = Replace(Wscript.ScriptFullName, Wscript.ScriptName, "H.bat")
  7.  
  8. '-----------------------------
  9. 'SETUP PROCESS
  10. '-----------------------------
  11.  
  12. Sub Refresh
  13.  Set objREAD = fso.OpenTextFile(CD,vbRead)
  14.  current=objREAD.ReadAll
  15.  objREAD.Close
  16. End Sub
  17.  
  18. Sub Main
  19. Do
  20.  create=InputBox(current ,"Text Editor: [*] to quit")
  21.  If create = "*" then
  22.  wscript.quit
  23. ElseIf create = "" then
  24.  Set objWRITE = fso.OpenTextFile(CD,vbAppend,1)
  25.  objWRITE.writeblanklines(1)
  26.  objWRITE.Close
  27.  Call Refresh
  28. Else
  29.  Set objWRITE = fso.OpenTextFile(CD,vbAppend,1)
  30.  objWRITE.write create
  31.  objWRITE.Close
  32.  Call Refresh
  33.  End If
  34. Loop
  35. End Sub
  36. '---------------------------------
  37. 'WRITTING PROCESS
  38. '---------------------------------
  39.  
  40. If Not fso.FileExists(CD) then
  41. Call Main
  42. Else
  43. If fso.GetFile(CD).Size = 0 Then
  44. Call Main
  45. Else
  46. Call Refresh
  47. Call Main
  48. End If
  49. End If
  50. Wscript.Quit
  51. CD.Close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement