Based on the complex variable method, the magnetoelectroelastic interaction of a generalized screw dislocation with an elliptical inhomogeneity containing a electrically conductive confocal rigid line under remote anti-plane shear stresses, in-plane electric and magnetic loads is dealt with. The generalized screw dislocation is located inside either the inhomogeneity or the matrix. The analytical-functions of complex potentials for stresses, electric displacement fields and magnetic induction fields in both the inhomogeneity and the matrix are derived. The image force acting on the dislocation are also calculated explicitly. The results show that the influence of the rigid line on the interaction effect between a generalized screw dislocation and an elliptical inhomogeneity is significant. In addition, the material behavior also plays an important role on the image force.