import docx
import sys

def extract_text(file_path):
    doc = docx.Document(file_path)
    full_text = []
    for para in doc.paragraphs:
        full_text.append(para.text)
    return '\n'.join(full_text)

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print("Usage: python docx_to_txt.py <docx_file_path> <output_txt_path>")
        sys.exit(1)
    
    docx_file = sys.argv[1]
    output_file = sys.argv[2]
    
    text = extract_text(docx_file)
    with open(output_file, 'w', encoding='utf-8') as f:
        f.write(text)
    print(f"Successfully extracted text to {output_file}")
