strApptEnterPath = "C:\Documents and Settings\krao\Desktop\environment.xml"
If CheckFileExists(strApptEnterPath) Then
Set objFile = oFSO.GetFile(strApptEnterPath)
' Checks for file attributes. This is a check for file being readonly. As the latests is taken from VSTS it will be marked as readonly. This code will uncheck the Readonly property
If objFile.Attributes AND 1 Then
objFile.Attributes = objFile.Attributes - 1
End If
Else
ExitAction "Fail"
End If
set objReadFile = OpenFile(strApptEnterPath,1)
strContents = objReadFile.ReadAll
iTmpLoc = Instr(strContents,"
strTmpVal = left(strContents,iTmpLoc-1)
strFinal = strTmpVal & "
strContents = replace(strContents,strFinal,"")
iTmpLoc = Instr(strContents,"")
strTmpVal = left(strContents,iTmpLoc-1)
' this is the exact if condition in the logic section.
strIfCondString = "C" & right(strTmpVal,len(strTmpVal) - 1)
strFinal = strFinal & strIfCondString & ""
strContents = replace(strContents,strTmpVal & "","")
strFinal = strFinal & strContents
objReadFile.close
set objReadFile = OpenFile(strApptEnterPath,2)
objReadFile.write strFinal
objReadFile.close
Set objReadFile = Nothing
Set objFile = Nothing
Function CheckFileExists (FilePath)
CheckFileExists = oFSO.FileExists(FilePath)
End Function
Function OpenFile (FilePath,mode)
set OpenFile = oFSO.OpenTextFile(FilePath, mode, True)
End Function
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.