variable electromagnet

You can use PWM to vary the strength of an electromagnet. And, a motor driver will work with PWM "both ways".

I'm thinking I will want to run anywhere from 0-3 or 4 amps through a maybe 4-8ohm resistance solenoid. Probably will use 20 or 22 awg magnet

Have you done this before? Have you researched the Ohms per foot (or per meter) for 20/24 AWG wire? ...That's at least couple-thousand feet of wire!