how to make an "archive" button for Mail.app in mac os x mountain lion to work with gmail accounts?
You could assign a shortcut to a script like this:

tell application "Mail" to tell account "Gmail"
    messages of mailbox "INBOX" whose flagged status is false and read status is true
    move result to mailbox "[Gmail]/All Mail"
end tell


This would only move selected messages:

tell application "Mail"
    selected messages of message viewer 1
    move result to mailbox "[Gmail]/All Mail" of account "Gmail"
end tell