The method you describe generally works. Things to look out for are sticky pistons, movement when you touque the bolt, and wonky posts.
Firstly, take the wheel and pads out, and very carefully push the pistons back into the caliper. Then squeeze the lever a little and check that they move together. Then push them back again. BE VERY CAREFUL – you don’t want to eject the pistons, or damage them by sticking a screwdriver in there to push them back!!
When you put the pads and wheel back and get ready to align the caliper, you need to tighten the bolts down just to the point before they bind the caliper to the post. Then when you pull the lever, tighten the bolds down a bit at a time to ensure that the torque doesn’t spin the caliper around the bolt.
Also, when you tighten the bolts, watch the caliper very closely to see if it twists in relation to the surface of the rotor. You may need to have the posts faced, or they could be bent.