A method for controlling a device for welding using a laser beam emitted by a laser, wherein the device comprises a scanner optical unit, which is moved by a guiding machine relative to a workpiece to be processed and which operates according to the principle of pre-objective-scanning or post-objective-scanning, and the beam path of which is guided by means of one or more active and/or passive deflection units, a projector which is moved with the scanner optical unit and is used to project measuring light in the form of measuring structures onto the workpiece to be processed, and an image sensor, which is moved with the scanner optical unit and which is sensitive in the wavelength range of the measuring light radiated from the projector, wherein the projector is disposed outside of the beam path of the scanner optical unit and the optical axis of which is tilted relative to the optical axis of the laser, and the measuring light radiated from the projector consists of at least one line, which extends transversely to a longitudinal direction of a welding seam to be produced on the workpiece to be processed, characterized in that a default value of a progression of the measuring light in the longitudinal direction of the welding seam is changed with respect to an impact position of the laser beam during the production of the welding seam and, in order to hold the real working progression constant along the welding seam to be produced even when there are height variations between the scanner optical unit and the component, - signals from the measuring light are recorded by the image sensor during the production of the welding seam, - the topology of the workpiece to be processed is determined, in the vicinity of the welding seam to be produced, from the image signals by means of a triangulation process, and - the default values for the working progression are adjusted on the basis of the topology data that are determined such that the deviations of the real working progression from the setpoint value of the working progression caused by height variations are compensated for in the progression of the welding seam; or, in order to adjust a real working progression, in which the quality of the image signals just suffices for the adjustment, steps are repeatedly carried out during the production of the welding seam, namely the steps of - recording a number of individual images per unit of time using the image sensor, wherein the number of individual images is at least twice as great as the number that is required for seam tracking, - determining the signal-to-noise ratio of each individual image, - classifying the individual images into good images when the signal-to-noise ratio exceeds a defined value, and into bad images if the defined value is fallen below, - determining an error quotient of bad images and good images, - increasing the default value of the progression when the error quotient of the individual images exceeds a certain value and reducing the default value of the progression as soon as the error quotient falls below a certain value. - signals from the measuring light are recorded by the image sensor during the production of the welding seam, - the topology of the workpiece to be processed is determined, in the vicinity of the welding seam to be produced, from the image signals by means of a triangulation process, and - the default values for the working progression are adjusted on the basis of the topology data that are determined such that the deviations of the real working progression from the setpoint value of the working progression caused by height variations are compensated for in the progression of the welding seam; - recording a number of individual images per unit of time using the image sensor, wherein the number of individual images is at least twice as great as the number that is required for seam tracking, - determining the signal-to-noise ratio of each individual image, - classifying the individual images into good images when the signal-to-noise ratio exceeds a defined value, and into bad images if the defined value is fallen below, - determining an error quotient of bad images and good images, - increasing the default value of the progression when the error quotient of the individual images exceeds a certain value and reducing the default value of the progression as soon as the error quotient falls below a certain value.