Grazing-incidence X-ray scattering is a common technique to elucidate nanostructural information for thin-film samples, but depth-resolving this nanostructure is difficult using a single or few images. An in situ method to extract film thickness, the index of refraction and depth information using scattering images taken across a range of incident angles is presented here. The technique is described within the multilayer distorted-wave Born approximation and validated using two sets of polymer thin films. Angular divergence and energy resolution effects are considered, and implementation of the technique as a general beamline procedure is discussed. Electric-field-intensity-modulated scattering is a general technique applicable to myriad materials and enables the acquisition of depth-sensitive information in situ at any grazing-incidence-capable beamline.