I drew an image of something I'm thinking of, but forgot what it was called:
Welcome to Physics Forums, Giwayume.
The simplest would be a solenoid-based plunger or hammer, etc. The core is either fully out or fully in, usually. Maybe you have something more continuously variable in mind? Something controlled by a stepper motor, maybe?
I would assume hydraulic proportioning valves have parts in them that work in this manner somewhat. Just a guess.
Perhaps an electrical solenoid with an opposing spring? I don't know how precise that would be though, with stiction of the rod being a factor...
You may be describing this:
Thank you for all the replies, guys! A linear actuator was what I was thinking of, but it's nice to see all the other options available. I think a solenoid plunger is actually a better (and cheaper) solution for my project.
AH well - that would depend on the particular project. Solenoids tend to need a lot of current if you actually want to operate them 'proportionally'. They are relatively cheap, though and good value for intermittent use.
If you ask an open type question like this one, you can rely on getting at least half a dozen alternative answers. I think that EE forum contributors are all frustrated (or practising) constructors and leap on any new project for some vicarious enjoyment.
Separate names with a comma.