No experience of giving medication for this - but my husband went through a phase of what you describe. Like a toddler on speed, he was for a while! Especially when we went shopping! Taking him to Aldi or Tesco was crazy. He would start a running commentary on everything, and be zinging around the shop as if he was on rollerskates! I'll never forget it. It was like "What's that? Is it good? Do you think I'd like it? Can we get some:? What's this? Are you getting some - hey what about this? Are we getting some of this -
HEY LOOK!! That sign says HALF PRICE SALE! Let's get some!!" - (the sign was about half way across the shop - he couldn't even see what it was that was on sale!
I ended up with three jars of coffee one day (he didn't like coffee - but we had to try them!). For a while, I at least managed to keep him with me by giving him the basket to carry, so he could explore what went into it. The final straw was as we left the supermarket one day, two very large women were leaning over a shopping trolley sorting their shopping. William leaned toward me as we passed them, and said in a very loud stage whisper "I really don't like ladies with fat a***s!"
After that, I started getting the groceries delivered. Then we still went to the shops and library every day - but just for a stroll around, or a trip to a cafe for tea & cake, so he could "meet and greet" people. He enjoyed it, and it took the pressure off me, as I could concentrate on him and not be trying to get shopping and keep control of what he was doing.
Best wishes - it's a truly trying phase. It didn't last very long with William though.