<?php



$docx = "ocry.docx" ;

// Define the command with the PHP variable
$command = "source /home/guilaw/public_html/scrpto/bin/activate && cd /home/guilaw/public_html/scrpto && cd /home/guilaw/public_html/scrpto && python3 hello.py $docx";

// Execute the command and capture the output
$output = shell_exec($command);

// Build the full URL to the generated .docx file
$url = "https://guilaw.com/scrpto/" . trim(urldecode($output));
?>


<script>
// Automatically trigger file download from PHP-generated URL
window.onload = function() {
    const fileUrl = "<?= $url ?>";

    const link = document.createElement('a');
    link.href = fileUrl;
    link.download = ''; // You can set a filename here if desired: 'output.docx'
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
};
</script>
