I am stuck in the following script,Please Help
' Discover Current Drive Path
curDrv = objFSO.GetParentFolderName(WScript.ScriptFullName) 'Drive Path
ulpath = curdrv & "\Locker"
propath = curdrv & "\Control_Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
passFile = curdrv & "\pass.txt"
If objFSO.FolderExists (propath) Then call Unlock
If Not objFSO.FolderExists (ulpath) Then
objFSO.CreateFolder (ulpath)
MsgBox "Folder Created Successfully" , vbInformation, "Process Success" & WScript.Quit
end if
If objFSO.FolderExists (ulpath) Then call Lock
WScript.Quit
Sub PassCreate
PSCR = InputBox ("Type a password to lock folder. Do Not use blank password for your safety.")
IF PSCR="" then MsgBox "Password cannot be blank" , vbCritical, "Faulty"
IF PSCR="" & objFSO.FileExists(passFile) then
objFSO.DeleteFile(passFile)
end if
IF PSCR="" then call PassCreate
Set objFile = objFSO.CreateTextFile(passFile,True)
objFile.Write PSCR & vbCrLf
objFile.Close
End Sub
Sub Unlock
PSW = InputBox ("Please Enter your 10 digit Password. Example : 9867123456")
Set objFile = objFSO.OpenTextFile(passFile)
Do Until objFile.AtEndOfStream
strLine= objFile.ReadLine
Loop
objFile.Close
If not PSW=strLine Then MsgBox "Wrong Password" , vbCritical, "Illegal Operation" & WScript.Quit
objFSO.MoveFolder propath , ulpath
Set FO = objFSO.GetFolder(ulpath)
FO.Attributes = FO.Attributes AND 0
MsgBox "Folder Unlocked Successfully" , vbInformation, "Success Operation" & WScript.Quit
End Sub
Sub Lock
Message = "Are you Sure you want" & vbCr & vbCr
Message = Message & "to Lock the folder ?" & vbCr & vbCr
X = MsgBox(Message, vbOKCancel, "Confirmation")
If not objFSO.FileExists (passFile) then call PassCreate
Select Case X
Case vbOK
objFSO.MoveFolder ulpath , propath
Set objFolder = objFSO.GetFolder(propath)
Set FL = objFSO.GetFolder(propath)
FL.Attributes = FL.Attributes XOR -1
MsgBox "Folder Locked Sucessfully." , vbInformation, "Process Success"
Case vbCancel
MsgBox "Nothing Done." , vbExclamation, "Process Aborted"
End Select
End Sub
Under sub passcreate if the password is blank first time nothing is written to the pass.txt so no password created.I want to prevent accidental blank password creation.I do not know how to cancel script execution if cancel is selected on the both the inputbox.