generic factory for external scripts