With a little ingenuity and an air compressor one could probably make their own foam spray gun using Great Stuff.
Start with a copper pipe Tee that has 1/2" or so main run with a 1/4 "Tap".
Add an air connection to one end of the main, and an extend the other end of the main run a few inches with some copper tube.
Figure out how to fasten the straw to the i/4" tap so it's not blown out when compressed air is flowing from input and out the pipe extension.
When you want to spray foam, press the button on the can. Foam mixture will flow, get caught by the air stream flowing through the Tee, and get shot out in small globs from the extension pipe. These globs will be deposited like wall texture material or stucco and start to expand as it cures. If possible use a smaller Tee but anything less than 1/2" is tough to find in most hardware stores unless you go to brass fittings.
That's the concept, maybe there are enough odds and ends in one's junk box to come up with something similar.
"A wise man can change his mind. A fool never will."
"You only grow old when you run out of new things to do"
2018 Flagstaff Micro Lite 25BDS
2004 Nissan Titan