PDF_Generation_and_Automation/replace_method.py
2025-09-02 15:41:10 +05:30

23 lines
787 B
Python

#!/usr/bin/env python3
# Read the original file
with open('force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js', 'r') as f:
lines = f.readlines()
# Read the new method
with open('update_popup_method.js', 'r') as f:
new_method = f.read()
# Find the start and end of the handlePDFDownloadReady method
start_line = 1555 - 1 # Convert to 0-based index
end_line = 1643 - 1 # Convert to 0-based index
# Replace the method
new_lines = lines[:start_line] + [new_method + '\n\n'] + lines[end_line:]
# Write the updated file
with open('force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js', 'w') as f:
f.writelines(new_lines)
print("✅ Successfully updated the handlePDFDownloadReady method with popup functionality!")