A controller for an injection molding machine capable of reducing an extension of a cycle time in a screw retreat process after the end of measurement, obtaining a more accurate and uniform measured resin amount, and determining measurement conditions in a short period of time. After the measurement is finished, the screw is stopped from rotating and retreated at a first speed V1. The screw is reversely rotated at a predetermined speed Rv in a set zone. As this is done, the screw is retreated at a second speed V2 lower than the first speed V1. After the reverse rotation zone is terminated, the screw is stopped from rotating and retreated at a third speed V3 to a set retreat stop position. By doing this, the cycle time can be made shorter than in the case where the retreat and reverse rotation of the screw are performed separately. Since the retreating speed of the screw is low while the screw is being reversely rotated, a sudden pressure change can be suppressed, so that precise measurement can be made. Since conditions for the reverse rotation and retreat of the screw can be regulated independently, they can be adjusted to optimum conditions in a short period of time.