generate custom automation code automatically