automatic generate references script