Operating or controlling locks or other fastening devices by electric or magnetic means {with electronic learning functions }