ya that would be possible, you would just bind the G1 key to whatever you want it to be and in the game set the key to certain toons, you dont want to macro it on the keyboard though as that would be automation as per bliz's TOS.

For example i have my G15 bound to Alt+Ctrl 1 for G1 and Alt+Ctrl 2 for G2 and so on and i would hit G1 and G2 which are bound in the wow keybinds in different combinations of walking forward/backward, right and left and i hold them down at the same time for different formations.