Detect in script if app is running