import os
import win32com.client

def count_word_comments(doc_paths):
    word = win32com.client.Dispatch("Word.Application")
    word.Visible = False
    
    try:
        for doc_path in doc_paths:
            if not os.path.exists(doc_path):
                print(f"File not found: {doc_path}")
                continue
                
            abs_path = os.path.abspath(doc_path)
            try:
                doc = word.Documents.Open(abs_path)
                comment_count = doc.Comments.Count
                print(f"File: {os.path.basename(doc_path)}")
                print(f"  Comments: {comment_count}")
                doc.Close(SaveChanges=False)
            except Exception as e:
                print(f"Failed to read {doc_path}: {e}")
                
    finally:
        word.Quit()

if __name__ == "__main__":
    files = [
        r"C:\Users\Administrator\.gemini\antigravity\scratch\bluebeam-comment-conv\05 05 23.13 10 markup.docx",
        r"C:\Users\Administrator\.gemini\antigravity\scratch\bluebeam-comment-conv\05 12 00 markup.docx",
        r"C:\Users\Administrator\.gemini\antigravity\scratch\bluebeam-comment-conv\05 21 00 markup.docx",
        r"C:\Users\Administrator\.gemini\antigravity\scratch\bluebeam-comment-conv\05 30 00 markup.docx",
        r"C:\Users\Administrator\.gemini\antigravity\scratch\bluebeam-comment-conv\05 40 00 markup.docx",
        r"C:\Users\Administrator\.gemini\antigravity\scratch\bluebeam-comment-conv\05 50 14 markup.docx",
        r"C:\Users\Administrator\.gemini\antigravity\scratch\bluebeam-comment-conv\06 17 19 markup.docx"
    ]
    count_word_comments(files)
