Python Forum

Full Version: How do I activate my script when another program opens?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
let's say I have program A (a default program in windows) and I have Script B (a python script but I wanna make it executable) How can I execute(automatically) Script B when program A opens or starts,,,
Thank you... Smile
Write a batch file:
    mybatch.bat
        start my_program.exe
        start python.exe test.py
To elaborate on heiner55's post - a level of indirection (a batch file) would be thes simplest solution. If you really want something more, and are willing to put the effort into it, you can look into things such as this. You might also want to checkout Gray Hat Python or its sequel for other information on how to achieve it. It's basically black magic so you're less likely to find something sufficiently cookie-cutter that it wouldn't be a decent chunk of effort.
After reading Gray Hat, you can read  Black Hat:
https://www.amazon.com/Black-Hat-Python-...bc?ie=UTF8