Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

@forbillian,

 

Try below iLogic code to write part name if does not exists.

Dim name As String = ThisDoc.FileName(False)
Dim Path As String = "C:\temp\Testing.txt"
Dim file As System.IO.StreamReader = New System.IO.StreamReader(path)
Dim found As Boolean = False 

For Each Line As String In System.IO.File.ReadAllLines(path) 
    If Line.Contains(name) = True Then
		found = True 
        Exit For
    End If
Next
file.Close()

If found = False Then
	oAppend = System.IO.File.AppendText(path)
	oAppend.WriteLine(ThisDoc.FileName(False))
	oAppend.Flush()
	oAppend.Close()
End If

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network