Embed a Python script in .blend?
Name the text datablock something.py and tick the 'register' checkbox. It'll run whenever you load the file, just like you want. 

You do need to enable autorunning Python scripts in your user preferences (this is disabled by default for security reasons).