Lotus Script: Removendo linhas do Notes.ini

From Wiki
Revision as of 17:57, 27 February 2014 by Ebasso (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Função que remove linhas do Notes.ini

Call RemoveLine("DELEGATED_MAIL_FILE*")
 

Function RemoveLine(pattern As String) As Integer
	
	Dim oneLine			As Variant
	Dim fileIn				As Integer
	Dim fileOut			As Integer
	Dim backupName	As String
	Dim iniLocation		As String
	
	backupName = "notes.dyn"
	iniLocation	= "C:\notes\notes.ini"
	
	Filecopy iniLocation, backupName
	
	fileIn		= Freefile()
	Open backupName For Input As fileIn
	
	' Update the notes.ini
	fileOut	= Freefile()
	Open iniLocation For Output As fileOut
	
	Do While Not Eof(fileIn)
		Line Input #fileIn, oneLine
		
		If (oneLine Like pattern) Then
			Msgbox( "Deleted line = " & oneLine)
		Else
			Print #fileOut, oneLine
		End If
		
		oneLine = ""
	Loop
	
	Msgbox  "Notes.ini updated"
	
	Close fileIn
	Close fileOut
	
 End Function

Ver também