Yup. That's how any auto or semi-auto weapon works, though they use different means for capturing that energy.
One problem with such a notion, though, is that such energy generally comes in the form of a lot of power for a very short bit of time. By contrast, things like fancy-shmantzy scopes require power over a much longer period of time. The idea of putting batteries in magazines seems like a reasonable one except that (1) magazines are generally designed to be reusable, a concept the batteries would thwart; (2) the amount of energy required in the course of using a magazine may vary a hundred-fold or even, possibly, a thousandfold. The beauty of Polaroid's solution for their film packets was that the amount of energy to shoot a roll of film is comparatively predictable; the OICW would not have such an advantage.