Evaluate Formula not working in COM

I’m using an OS level scripting tool with LotusScript COM. I need to loop through all attachments in a document (NOT in rich-text). My problem occurs when I have two or more attachments in a single document with the same name (Ex: The same document attached twice in the document). From other posts here, I’ve seen that evaluating @AttachmentNames is the best way to do this, as for the duplicate attachment, the internal name is returned.

However, through my script throws an error while I try to use notessession.Evaulate. Somehow none of the formulae are being processed from outside the Designer environment.

Could you please let me know if Evaulate actually works through COM, or if there’s any other way to perform the above tasks?

My code looks something like this (This is Auto-IT script)

Dim $s = ObjCreate(“Notes.NotesSession”)

Dim $db = ObjCreate(“Notes.NotesDatabase”)

Dim $vw = ObjCreate(“Notes.NotesView”)

Dim $doc = ObjCreate(“Notes.NotesDocument”)

$db = $s.GetDatabase(“myserver/myorg”, “testdb.nsf”)

$vw = $db.GetView(“All Documents”)

$doc = $vw.GetFirstDocument()

$fn = $s.Evaluate(“@AttachmentNames”, $doc)

VBSCRIPT Gives the same error too

Dim se, db, vw, doc

Set se = CreateObject(“Notes.NotesSession”)

Set db = se.GetDatabase(“myserver/myorg”, “testdb.nsf”)

Set vw = db.GetView(“All Documents”)

Set doc = vw.GetFirstDocument()

Set att = se.Evaulate(“@AttachmentNames”, doc)

Thanks in advance