Run a script when a program is started