I want XCode to run a particular script before any file is saved.
Is there a way to do that?
No, there isn't.