How to capture a screen shot of all spaces

Regularly I use more than 4 spaces in my Macbook Pro ( lion/10.7.1 ).

Can I get a screenshot of all spaces at one time ?


Solution 1:

screencapture ~/Desktop/1.png
osascript -e 'tell app "System Events" to key code 124 using control down' # ctrl-right
sleep 0.5
screencapture ~/Desktop/2.png
osascript -e 'tell app "System Events" to key code 123 using control down' # ctrl-left
# montage ~/Desktop/1.png ~/Desktop/2.png -tile 2x1 -geometry +2+2 ~/Desktop/`date '+%y%m%d%H%M%S'`.png

montage comes with ImageMagick.