In traditional methods for measuring case depths (CDs) in two types of surface-hardened steels, two prediction models are generally established. However, it is difficult to recognize material types (MTs) of surface-hardened steels based on the appearance of steels, thus leading to difficulty in the selection of an appropriate model from the two obtained models for predicting CD in a given surface-hardened steel. The established model should allow both the prediction of the CDs in two types of surface-hardened steels and MT recognition. In this study, an intelligent approach is proposed to automatically establish a prediction model for simultaneously performing MT recognition and CD prediction in two types of materials. The intelligent approach involves sample preparation, magnetic hysteresis loop (MHL) measurements, feature generation, feature selection, feature extraction and prediction model establishment. In the feature generation process, the entire feature set is generated from measured MHL signals. In the feature selection process, the binary-bat-algorithm-based (BBA) feature selection is firstly repeated 50 times to select feature subsets from the entire feature set. Then, a threshold criterion is proposed to extract suitable features from the repeated feature selection results in the feature extraction step. Finally, a modified neural network is proposed for predictions. The experimental results showed that the extracted features could give richer descriptions of the MHL signals, as well as the properties of steels. The established prediction model showed good performance in simultaneously performing MT recognition and CD prediction in two types of materials. The prediction error of case depth (PECD), misclassification rate (MR) and test time were mm (3.47%), 0% and 0.0105 s, respectively, demonstrating that the proposed approach was applicable for on-line CD measurements in two types of surface-hardened samples.