Macros for the new version of Gmail #

As those of you on the new version of Gmail might have noticed, nearly all Greasemonkey scripts that used to work on the old version no longer do. Even though it looks pretty similar, the new Gmail is entirely different from a JavaScript, HTML and CSS perspective, so this isn't surprising. Some of the scripts are no longer necessary. For example, saved searches aren't really needed, since searches now get their own URLs and can be bookmarked.

However, my Macros script is still needed; while the new version of Gmail does have additional keyboard shortcuts, it's still not possible to do everything from the keyboard. I've therefore ported it for the new version of Gmail, to install it, click below.

Install Gmail Macros

More specifically, the following keyboard shorcuts have been ported over:

  • g: Go to label
  • l: Apply label
  • b: Remove label
  • e: Archive (regardless of view, unlike "y")
  • d: Discard (mark as read and archive)

There is also a new keyboard shortcut, which the old script didn't have:

  • f: "Focus" the current view (only show unread, starred or inbox messages)

You may remember the script supporting other keyboard shorcuts. Since the new version of Gmail supports additional shortcuts, those have obsoleted. The new ones are:

  • shift + i: Mark as read
  • shift + u: Mark as unread
  • shift + 3: Move to trash (not actually new, but not many people seem to know this one)
  • shift + 8 followed by a, n, r, u, s, or t: Select all, none, read, unread, starred, or unstarred

For those of you adventurous enough to look at the script source, you'll notice that it uses a gmonkey object that is present on the window, which in turn gets you a gmail object with methods like getNavPaneElement() and getActiveViewType(). What this means is that the version of Gmail, in addition to being faster, also has semi-official support for Greasemonkey scripts. I'm pretty sure docs for this API will be out soon, but in the meantime, feel free to look at the script and use a tool like Firebug to investigate the properties of the gmonkey and gmail objects and play around.

Update on 11/06/2007: And here are the semi-official docs.


You just made my day. Thank you, thank you, thank you!!!

Fantastic !

My account switched yesterday and today you come up with a breand new script... awesome !

Is there any chance you will transfer the Labels Color script as well ? These are really the two most useful scripts ever created for gmail (with the saved searches, but as you said, this is over now).
Does this mean that you won't be updating the "saved searches" extension to work with the new gmail?
Sorry, but what does Shift+t do? You seem to have a typo in the description.
I'm glad to see that this has been updated! Is there any chance of getting the Gmail label color script updated too?

Thanks for all your time on this project!
I disagree, I think the "saved searches" capability is still needed. With it, I could quickly alter my view of my mail. It was nicely integrated into the gmail UI. If I relegated my saved searches to my bookmark manager, then I would need to perform more browser actions to do the same thing that only took one action before. I hope we see an updated "saved searches" user script!

I like new even more since IMAP is enabled and I've changed my labels in more "folder" kind of organization.
So, now I have something like dev/perl, dev/osx... and new script is handling this so nice!

Thanks again.
Is there any way to map the new keyboard shortcuts to our own? I like using 'r' for mark as read rather than 'shift+i'... I checked the code but there's no simple handlers table like in the old version.
I've been lurking around your blog, hoping for this update. I've been using the old version of Gmail, because the new one broke your script. I guess that shows how useful it is. :)
Thank you so much! This is a great bit of news as I was really missing the label function.

Thank GOD. Mine just updated today and I was totally non-functional without the shortcuts. Thank you!
Need I say, w00t! The diehards over at the Gmail Power Users group on Google Groups latched onto this, and it looks like we'll have most of our old script versions back to work with the new version of Gmail.

Any chance of configurable shortcuts and/or integration with mainstream Gmail? :D

It really would be useful to have "New Label" functionality as implemented in an old version of the script (modified by Brent Nef). Any chance of you making a version of your script with that functionality for the new Gmail codebase?
Is there any way to use "t" to delete a message instead of "shift+3"? It's really inconvinient now.

Seconding, the 't' for delete message. it's so much better than Shift+3.
I also second the suggestion to restore the 't' key for moving messages to trash. A single keystroke for such a common function is so much nicer than Shift+3
Any idea when Gmail 2.0 will be released to Google Apps? It's showing up on my gmail account, but not Google Apps yet.
Great Work!!! Thanks for updating the script...

I also would like to request used configurable shortcuts... for example, I would love to change "delete a message" from "#" to "t" or something else.

Thanks again!
thank god it's been ported!
one little quibble... why not bring along all the old shortcuts....
I'm so used to 'Shift+x+u' and 'r' and 't'

the default Gmail ones seem a little random to me... how does shift+i = mark as read?

would also love to get that label colors script
thanks much--excellent work.
Two things I've realized:

1) The label selector banner never really shows the picked label name. I noticed that the activeLabelAction.func() call was moved out of the setTimeout--this seems to be primarily to prevent the More Actions list from showing up when the mousedown event is simulated, but in doing so, it also eats the banner.update() behavior as well.

2) If the user has enough conversations displayed in the list such that scrolling to the bottom of the list makes the top More Actions list go out of sight, applying a label on a conversation sets the window.location.hash value and the window jumps back up to the top of the message list. Is there a way to specify the More Actions list in the footer?
Excellent work, again...

Keep up the good work.

For all those people asking for the 't' shortcut to be re-instated, I've just looked in the GMail help and the '#' key will move a selected item to the trash.
I'd love to have this kind of API for Google Reader

(e.g. for notifying my private website, analytics etc. whenever i share an item. star an item etc.)

Is something like that available?
What happened to the help screen? Would really be useful as I try to adjust to the shortcut changes.
Thank you for the update, Mihai! My account changed yesterday and I felt crippled without Gmail Macros. :P

I'd also like to add my votes for:

1. Restore the r shortcut for marking messages read since it's more intuitive than Shift+i and aligns with the Shift+8 r combination to select read messages. (It's unfortunate that u is already taken but Shift+u is close).

2. Bring back the help screen. It's a handy guide for learning all the shortcuts (both native and Gmail Macro) as well as quickly remembering infrequently used ones. Thus, a good feature for newbies and veterans alike.

3. Although the t shortcut is intuitive, it's rather dangerous since it's next door to y. So, as much as I like it mnemonically, Shift+3 is safer and I vote no on restoring the t shortcut.

4. Saved searches is definitely worth keeping. As already pointed out, the integration is the benefit. Bookmarks aren't the same.
I love this script, thank you for taking the time to update it. If you find yourself working on it again, I might suggest a shortcut for "Display Images".

However, I really just wanted to say thanks for writing this script.
This comment has been removed by the author.
@Peter: I agree with all your votes, save for one: saved searches. I never found much use for them.

With regards to marking messages as read and unread, how about "r" for read and "R" for unread? I have that in the version I'm running now on the old Gmail (I'm not updated yet) and it's been quite useful.

Also, I'd like the option to use either shift-8 (*) OR "x" to mark things; I could get used to *, but I'm used to "x" with my current macros (modified by Brent Nef, as mentioned above).
I third 'T' for trash! That was my most used shortcut! Way easier than shifting for #.

P.S. Thank you, thank you, THANK YOU for the update!
How do you install these scripts?
How do you install these scripts?
0) Thank you for porting this to the new gmail!
1) I also like the "t" for trash.
2) I also think the saved searches were better integrated into the UI.
Waiting on "t" for trash and "r" for read before I switch to the new Gmail...
Great work. I definitely agree that using the old hotkeys would make this a lot better. I understand that this is likely just an initial patch to work with the new Gmail version. Keep up the good work.
@Peter, I have to disagree about 't' being dangerous. Gmail will indicate at the top after every action whether the conversation was deleted or archived, and if you accidentally chose the wrong button, it's as simple as hitting 'Undo'.

As deleting email is the Gmail action I use the most, I am strongly in favor of the 't' shortcut, as it is much faster and easier than Shift+3.
Can we also get shift-enabled shortcuts? Like "r" for read, shift+r for unread; "l" for label, shift+l for unlabel; etc.? It's much easier if the shortcuts for two opposite actions are in the same place.

Also, when I view the shortcut list, it's really huge and gets cut off at the bottom, with no scrolling. Also, the title is "Keyboard shortcutsnullRAZXF">", which I'm assuming is not the intended title.

If you do make updates, you'll post a comment back here, right? :)
Give us Help! shift+h ?
Please bring over the Label Colors script. I loved it and desperately need it for 2.0.
thank you very much for the update. These shortcuts make gmail usage much better...

however, the need for t for delete is more than necessary!!!

maybe, you can put it as an option or two versions for those that think that it is dangerous. but there are too many that need that, among who, me...

thanks again
Thanks Mihai for the macros script, can I also vote for 'H' shortcut?

Labels colouring wouuld also be a big help.

THanks again for revolutionizing my gmail life!
This comment has been removed by the author.
This comment has been removed by the author.
This comment has been removed by the author.
This comment has been removed by the author.
Can you redo the color labels? I find them really handy.
here's another vote for re-introducing the Saved Searches function. Even though searches are linkable now, that does not and should not take the place of saved searches. Saved Searches presented a very nice and convenient interface for searches - adding several more gmail-specific bookmarks across multiple computers is definitely not convenient.

on gmail in general - the new backend is very nice. The interface is very responsive - very nice.

I'd like to throw out support for some other features, though, like
1) Ctrl/Shift-Select to select multiple emails, instead of the checkboxes
2) drag-drop emails into labels or mailboxes
3) some kind of tabbed interface so you can work on multiple messages or views at the same time, in different gmail-specific tabs.
I get a curious bug, driving me nuts: when this script is enabled, the space bar no longer works for scrolling, and I am reduced to using the mouse.

This happens most of the time but not always. This is on Firefox on Vista.

I have no other Greasemonkey scripts running. When I disable this script and reload Gmail, the space bar works fine again. And I never have this problem with the older version of Gmail and old scripts.

Anybody else having the same problem?

And please add the help function listing all the shortcuts, so we don't have to consult a web page for them every time!

Thank you for the fast port. I am a big fan and appreciate all your work.

Overall, though, I am very unhappy with the new gmail and the completely messed up keyboard shortcuts. I am going back to the old gmail and old shortcuts until some day when I can be productive with the new one.
Thanks for the update! Can't live without my macros.

I'd vote too for t=trash and r=read. I miss those :(
Hello again, still waiting for some help as to how to use the scripts. I get the option to Save or open the file. If I click Save, is asks where to save it, and if I click Open, I can then click "run" but get an error message. Sorry for my ignorance.
@FlatGreg: Brent Nef has applied some of his mods on the original script to the new version. You can download it from Google Groups' GMail Power Users group ( ). Go to the files section to download it; it's named (at least now) gmail-macros-new-bn.user.js. There are still a few bugs, but it's nice to have the "n" and such back.
@most recent anonymous: Are you using the Opera browser or Firefox with Greasemonkey? That's what you need to use the script.
Save to desktop then right click then open with Firefox
I'm using Firefox. Greasemonkey doesn't work with the new gmail. I am using it with the old version.
@Carey: Yes, it does. You have to use this version of the script, and a lot of userscripts haven't yet been updated (I want my Gmail Signature Float!). Back to the main point, be sure you're using the latest Greasemonkey version and the latest Gmail Macros release (the one on this page, of course). Post back if it still doesn't work.
Hi, love Gmail Macros. On the new one, I noticed there no longer is 'h' for help menu. I use some shortcuts more than others. It is nice to bring up the help menu if I forget a shortcut.
Another handy shortcut apparently not mentioned in the gmail info is the period key ("."), which opens the label dropdown menu and allows one to scroll down to apply whichever label to the selected message(s).
@Anonymous (the one who mentioned the period): That's a neat undocumented shortcut you found there. I'll have to remember it for the next time I'm on a different computer. Macros still rocks, though! I don't have to scroll through 50 labels...
How about apply NEW label?
Folks, here's a stop-gap script till we persuade Mihai to update the **Excellent** "Saved Searches" script.

any chance to get this working also with GreaseKit for Safari?

@latest Anonymous: Brent Nef has a modified version of this script with that functionality. Get it at the Google Group I mentioned earlier (GMail Power Users).
I took the liberty of updating Brent Nef's most recent script (based on Mihai's wonderful work), which he posted over at the Google Groups' GMail Power Users group (

I added the help screen back in. Please note the X+key combo doesn't work (as noted).

Here's the script:
I'm not sure how to upload it to the GMail Power Users group site.

Brent or Mihai, if you see this, can you toss it up on the GMail Power Users group site (if you think it's worthy).
I have the same problem with scrolling. Neither spacebar nor pageup/pagedown work any more.

It's enough of an issue that I'm going to disable this script.
The most frustrating part of gmail to me is that we can't delete then immediately go to the next message. I know I don't fit gmail's view of email, but I don't need to keep marketing messages, digests of list activity, most newsletters, etc; so I delete most of the emails I receive.
@Voyagerfan5761: Thanks for the info on the update to Brent's version of the script. He's got some nice stuff in there and the key mapping (from key codes to actual letters) makes it easier for anyone to modify to their liking which keys do what.

@Anonymous: The period-key shortcut to open the More Actions menu is a nice find. Thanks for sharing.
@GreenPlastik: I've got a copy on my hard drive. I'll upload it later today, if someone else doesn't get there first...
@Voyagerfan5761: Made one small tweak to the help menu. Had left in a trailing comma. Should work better now. Same address for the download as previously posted. Sent it to you by email too.

@miles: if you think that would be a useful feature (delete and next). I can throw it together. Let me know. Shouldn't be much different than the function for archive and next. Problem would be that you would need a command for delete and next, as well as delete and previous. Let me know what you think.
@GreenPlastik: Got it! I'll install into my browser and then upload it to the GMail Power Users group. Of course, you can always join if you want to... Hint, hint. :D
GreenPlastik: There are still a few kinks in it. I'm no GreaseMonkey (ouch), but I'm pretty sure there aren't supposed to be two help boxes when you hit "?". And the one that pops up on "h" doesn't go away. It looks like the one that pops up only on "?" is what Mihai intended it to look like, so perhaps you can bind that screen to the "h" key and remove the second one (which is too high on the screen, too)?

PS: Are you a man or a woman? I feel sheepish asking this, but I'm posting info on this script variant elsewhere and I don't know whether to say "he modified" or "she modified". :P
@Voyagerfan5761: It's ok to ask. I'm a guy. As for joining the power user group, how do I go about doing that?

As for the help menu. I just got one. I can't get it to go away on 'escape' for some reason, but then again I haven't tried that hard *g*. If anyone has any pointers, lemme know. For now, if you look at the help menu on the right side, it list a hide option by pressing Shift-H ('H'). there shouldn't really be two different menus mostly because both ? and h call the same function. I'll remove one of them though and see if that helps.
@GreenPlastik: Since you're developing Gmail scripts, I'll assume you already have a Gmail account. Just go to the Group URL ( and click the "Join this group" link in the right-hand bar.

Regarding the help menu, Shift-H does work, though I can't see the top portion of the box. Somehow, and I have no idea what the method was, Brent made his old one scrollable. You'll have to ask him what he did. I'm guessing it's something to do with CSS.

Meanwhile, could you make it so clicking outside the box or hitting Esc closes it? That way it won't be such a shock for people switching form other versions, and the usability is a bit easier. Brent's original script should be able to help with that, too. There are several archived versions of the old Macros scripts in the Group's files section.
Thank you so much!!! I didn't know what I was going to do.
Tried to download but when I click on the link I get a page with what looks like HTMl or some other sort of letters and such. Please help!
Just a typo; Shift+8 + t selects all un-starred, not unread as mentioned in the OP. Thanks so much for updating this script, I've felt a little lost without it the past week. Thanks thanks thanks!
Add me to the pile: thanks so much for the update, and pleeeeeease delivereth colorlabels unto us. They're really the only reason I use gmail, and I ain't changin' to version 2 until color labels come with.
can't use 'yesterday' without 'Saved Searches'! :(
i'm having some problems with the shortcuts today...

i hit 'l' to label 2 marked conversations, then begin to type 'software' to label them...however, the 's' ends up starring the conversation i'm pointing at, and eventually i end up writing a reply to the email...not what i wanted at all. through all this, the 'apply label' box floats mid-screen, and i have to refresh the page to make it go away.

has gmail been further modified since this script was updated?
> i'm having some problems with the shortcuts today...
> i hit 'l' to label 2 marked conversations, then begin to type 'software' to label them...

I hit l, and then start typing "software" (or "stuff" in my case) and it works fine. The dialog shows "software", and I don't get a reply window or archive window, etc. Strange, don't know why you're getting this. Can you check the javascript console (Tools, Error Console) and see if there are any javascript errors from the script? (Helps to click on the Errors tab to hide all the warnings). May be interference from another script or something like that.
It's so good to have BG2 back, but I would like to add support for the requests for the "label colours" option. It was my favourite option, and I do hope it can make a comeback. Thanks again.
tested again, and the error console doesn't give me anything. i've got no other scripts running on gmail either.

just now, tried to label something 'personal', and ended up archiving them (because of the 'e' keypress, i think). the label box didn't register any keypresses at all, and stayed there once the conversations were archived.
I don't want bookmarks, I need my saved searches! Once they were gone I noticed how depended I got on them (and no, just bookmarking something is not the same and while being a keyboard junkie, I never got along with the ones of additional makros, they always made me trash /destroy links).

So please, pretty please could you make them work again and never abandon them? Google will only provide for so long the older version where they work :(
It appears that an update has been made that fixed the scrolling issues with the spacebar and pgup/pgdn keys.

I'm using it again.
I used to use g+i to effectively refresh the inbox. Very handy when waiting for an email to arrive (for account verification, etc.). With the new version (of either Gmail or the macros, I don't know), g+i doesn't refresh the inbox.

Has anyone else noticed this?

@Rob: Using g+i shouldn't be necessary any more; Gmail's message list can be refreshed with the built-in 'u' shortcut.
Voyagerfan5761 said...
> @Rob: Using g+i shouldn't be necessary any more; Gmail's message list can be refreshed with the built-in 'u' shortcut.

That's good to know. I used to use g+i to refresh the inbox also, I'll just start using u from now on. Thanks!
@rocketmonkeys: No prob. That one's actually an official Gmail shortcut. zOMG! Google made a super-useful shortcut, yet again!

By the way, GreenPlastik, Brent's been updating his version of Macros, as I'm sure you know from the Gmail Power Users group. It looks good. Google made a DHTML prompt for the new label action, though, so it's not as convenient as before. The return key no longer hits OK for you; you have to enter the label, then tab to OK and hit return. Ho hum...
I really appreciate you coming out with this quickly.

I also vote for 't' for trash,
'N' for new label, 'L' for un-lable, and pretty much most of the original short cuts. I think the key is to make them as easy as possible and as efficient as possible.

Desperately need colored labels as well.

I know you will continue to make this the best product ever.
Thank you so much, I've been hoping this would come out since Gmail upgraded.
For anyone looking for an upgrade to Label Colours for Gmail "2.0", see:

I've only just installed it, but it seems to work so far.
well, i've found a problem in the way Macros works with the Colour Labels script can't use the macros to label something with a colour suffix.

as i just commented on the colour labels userscript page:

"there seems to be a conflict with the new version of GMail Macros. attempting to use the macros to label something with a colour suffix doesn't work.

for example, attempting to label something 'MyLabel #000000' results in an error/alert box claiming that GMail cannot find the node 'MyLabel' (it does not seem to look for the label+suffix, just the label)."

not sure which script would need to be modified to make them compatible.
I also wouldn't mind these working with GreaseKit in Safari. Any idea if it could be implemented?
Me too, I would like the "t" for Trash shorcut may be implemented again.
It was one of the best shortcuts.

More over, in France, we don't have the same keys for #. I must use Alt GR + 3 :-(
I also use Folders4Gmail and the l action to apply a label does not look for unique name when typing in a label name, but looks only for the first occurrence of the letters. Thus I cannot apply the label Personal\Family because the action always picks Personal. Would be nice to be able to use this macro with Folders4Gmail.
your script interferes with gmails "g+" navigation shortcuts. and it completely BREAKS g+c for contacts.

tsk tsk! u should use shift+g
Any chance of getting a Flock version in the future??
I just noticed that your hint for expanding the filter field (Sunday, April 23, 2006) no longer works on the newer version. I loved this work around. Any idea on how to keep this work around going with the newer gmail?
For those of you who have asked:
In order to install the gmail macros, you need to install Greasemonkey, restart Firefox, then click the 'Install Gmail Macros' link. If you do not have Greasemonkey installed, you will only get a page showing the Javascript.
Request for enhanced feature: Since IMAP was introduced, I've moved a lot of folders from Outlook up to Gmail. The "l" to apply a label is great, but it gets a bit tedious type "First foldername/next folder". How 'bout taking a page out of Quicken's book and once the first folder matches uniques, have the "/" character complete the folder name? Makes Quicken labelling wicked fast!
@My own November 7 comment: The problem with the shortcut list appears to have gone away by itself. The list I was seeing was actually part of Gmail, and the junk characters are now gone; the font size has returned to normal.
I believe it's already obvious this is the gratest script of all time for GMail.

There's just one thing I think it's missing. GMail has a way to go to all unread messages (l:unread) acting as if there is an 'unread' label. But hitting l and typing 'unread' does not access this functionality. Do you think you could add it? Either accept 'unread' as a built-in label, or have a g+u to go there. That would really make it _flawless_

Thank you =)
Where is the "help" message?
Please bring back the "h".
There /is/ a help dialog. Press "?".

It doesn't have the Macros specific changes though, but you're probably using Macros because you're using the extra keys, so it won't be difficult to remember.

g/l/b for label actions.

archivE, Discard, Focus
Here's another vote for a rewrite of the saved searches script to work with the new version. Bookmarks are not nearly as well integrated into the UI, the saved searches box under the labels box was so nice. I miss it. :(
Still having a huge problem with scrolling!

Description: open gmail, navigate to a label using macros, navigate back to Inbox. Presto! Nothing works for scrolling the screen: space bar, page down, arrows.

Nothing! Annoying like hell.

The only way I know to fix this is to press "/" to get to the search field and then press ESC. Then I can scroll.

Running Firefox on Vista. I uninstalled ALL other add-ons and Greasemonkey scripts for testing this.
> Still having a huge problem with scrolling!

I've noticed a lot of little problems like this with Firefox. I haven't been able to figure out what it is, but I've also seen these on google reader and also on any webpage opened by google reader.

What used to happen is that I'd press "V" in reader to view a webpage, and it'd open in a new tab in the foreground. However, at this point I would not be able to use any keyboard commands (up, down, pageup, spacebar, /) for anything. I could hit Control+F for the find bar and then escape, and then everything would work. I could also click once on the webpage and then it would work.

This was never related to textboxes or inputs capturing the keyboard, it was all due to some firefox focus bug. A while ago (few releases back) it used to do the same thing, but when I was looking at the foreground tab and pressing up or down, it would actually move the original page without my knowledge (all keyboard commands were sent to the wrong tab). It hasn't done that in a while.

My thought is that all these focus bugs are firefox related, but I could be wrong. Recently gmail has been giving me more trouble when it randomly decides to not respond to keyboard commands as you describe. Often I'll either go to another tab and return, or I'll archive "A" an email, and then the whole thing is unresponsive. I'll have to click on the page to get any keyboard commands working again. Frustrating.
> Still having a huge problem with scrolling!

I am sure that this is the problem with Mihai's script and not with Firefox.

Here is how I fixed it today: I uninstalled the script and installed "Modified Gmail Macros v.2.0" from the "Gmail Powerusers" Google group. I am not having the described scrolling problems with that script.

Normally, I am trying to stay with the original Mihai's scripts, figuring they would be faster and have fewer bugs... But there was no response from Mihai to these scrolling problems.

Conjecture: the extended macros will appear soon in the official version of Gmail. Indeed, the colored labels are already there...
@admirer: I'd like to hope that's well-founded conjecture that will come to fruition after New Year's, when the Gmail Team returns from their holiday break. Oh, to use Macros without an extension... And I'm sure Google could add the customizable macros available in the modified script.

How about Attachments Icons, too?
I LOVE this extension, so THANK YOU! Has anybody else had trouble using the macro shortcuts for applying labels with forward slashes?

It doesn't seem to recognize labels with forward slashes which is how Gmail works now with IMAP folders.

I'm using "Better Gmail 2" extension on Windows Firefox 2. This does seem to work with "Better Gmail" original, using the "Older Version" of Gmail.

Thanks in advance for any helpful comments.
Thanks for the script. Good work!

By the way does this script work with hosted Google Apps mail?

Are you going to update the fixed font toggle script for the new Gmail?
Like a previous commenter, I'm having trouble using "l" to apply labels to messages. I hit "l" and the Apply Label window pops up as expected. However, as I'm typing the name of the label I want to apply, if any of the letters I type match another Gmail shortcut (just the unimportant letters like r, a, s, p, e) that shortcut is invoked and the Apply Label window is still there. This has caused me to inadvertently discard, mute, archive, etc. messages. God forbid if I invoke two shortcuts in a row, because then I can't Undo my mistake.

Since this doesn't appear to be happening to too many other people, it's probably something on my machine. I'm using WinXP Tablet Edition on my Toshiba Tecra M7 tablet PC. I'm also using UltraMon & Maxi-Vista to support three monitors. I have many add-ons enabled; here are the relevant ones: Better Gmail2, FFClickOnce, FirefoxView, Firebug, GeckoTIP, Google Browser Sync, Google Gears, Grab and Drag, GreaseMonkey (obviously), IE Tab, Mouse Gestures, MR Tech Local Install, Plain Text to Link, Tab Scope, Skype, Web Developer (and a few others I doubt are related).

If anyone else is having this problem, can you post your PC setup and which of these extensions you are using? It's really frustrating and hopefully someone can help me figure out what's wrong.

@My Previous Post - I figured out the problem I was having with hitting 'l' to Apply Label and having other keyboard shortcuts take over. This only happens if you don't have the conversation selected first. Sounds like a stupid mistake, but it's tricky because you CAN label conversations without them being selected first (but only if none of the letters in your label match another keyboard shortcut).

So using l to Apply Label works for some labels and not others if you don't first select the message(s) to label. It works ALL the time if you DO select the message(s) first. Hopefully, this will help someone else who was as confused and frustrated as I was.

@My Previous post (again)
Turns out the problem I was having is still an issue if you are viewing an email (i.e. not in the conversation thread view).

For example, if I'm viewing a message and want to add a label that starts with an "S", I hit "L" and the Apply Label window appears as expected. However, if I type "S", instead of having my first label that starts with an "S" appear, the message gets starred.

Is anyone else having this problem or know of any way around it?

I'm having a problem using "G" to go to any folder. I press "G" the menu comes up. I type a folder, the menu disappears, then nothing happens. Anyone else having this?
The script has been updated to handle the latest updates to Gmail (where the JavaScript runs in an iframe), so the "g" and "f" commands should work again.
When I try to shortcut to my contacts, I am forced into the chat section.

What gives?

Any thoughts/advice?

I think Mihai has some sort of pressure from GMail to not add shortcut 't' for Trash. Here a small and simple patch on top of Mihai's script, to get 't'rash working:

on line 24 paste this one line:
var DELETE_ACTION = "10";

then on line 85, paste the following code:
// t: delete (move to trash) action
84: function() {
var deleteButton = getFirstVisibleNode(
evalXPath(".//button[@act='" + DELETE_ACTION + "']", getDoc().body));

if (deleteButton) {
simulateClick(deleteButton, "click");
} else {
clickMoreActionsMenuItem("Delete", ARCHIVE_ACTION);

thats it, refresh your GMail wnidow/tab, and start hitting t to move a button to Trash.
With the way I use gmail, I'd actually like a "label and mute" macro. I have bins like '!0 - afternoon', '!1 - tomorrow', '!2 - midweek' and so on. What I typically do is label a conversation that I can pick up later and then mute it. Then when the time comes, I'll move the conversations to my inbox (unmute them, effectively) and sort through them again.

Basically a GTD method.

In any case, thanks for your work on this!
There's no conspiracy about the lack of a "t" for trash shortcut. I don't see a need for adding another shortcut when one already exists (shift-3), and I generally remove shortcuts when Gmail adds the equivalent functionality (e.g. I just removed "e" for archive since they added it).
I've always used # as a trash shortcut and heve never even seen the need for a T shortcut, especially since # is almost 100% sure not to be pressed by accident(except by accident trying to click !).

The need for a saved searches box in addition to the labels box is so apparent. I use saved searches all the time(like "is:unread in:inbox" and other useful saved searches that it is annoying to have to memorize) Using bookmarks for saved searches sucks really bad. :( I'm surprised that google hasn't already implemented this feature.
I'd kill for "expand all" and "collapse all" shortcuts, too. I can't tell you how often I'll have to mouse over to click that and on my laptop it wastes a lot of time. :)
HELP ! This is way over my non-computer literate head...every time I try to print something from word or publisher, I get the error message that says the "Macros in this project are disabled" and I cannot Enable them from th directions given in the HELP areas...HELP !
@Most Recent Anonymous: The macros you are talking about have nothing to do with Gmail. They are Microsoft Office macros. Try searching for "Microsoft Office macro help" on Google or in Google Groups, and you should have better luck.
I've been thrilled to have this back, but as of this morning it seems to be broken for me. Google must have updated something? Just FYI, in case you didn't already know - I can't live without the macros!
Er...I take it back. I guess something must have just not loaded right. After reloading my browser everything works as it should. Thanks a lot for such a great extension to gmail functionality!
I am having the exact same problem as omalley73 with apply label (l) completely not working. Nothing shows as you type, other commands happen as you are typing, and the label selection box often gets stuck on the screen. This happens with either macro set in BetterGmail 0.3.3. This problem has been happening for weeks.
First off, excellent script!

Now that you're all buttered up =) I'd like to make a request (if this is even possible):

Send an email + archive the thread in one step. Instead of tab, enter, e to send then archive a thread, could you cut that into one step? (I'm not sure if this is feasible because of the text box limitations.)

I hope you like my idea and there is an easy way to implement it. Thanks!

Am I right to say that as per today (2008/03/24) a new GMail version has been rolled in? I am noticing again that my scripts are not working anymore.

I think that indeed there is a new version, but the scripts are correctly working, and the problem was in fact caused by a wrong inclusion rule.

Great job, thanks a bunch for this!
Hello, I also want "SAVED SEARCHES" for gmail's new version. Thanks.
Any chance of a "tab expansion" function on the 'l' apply label macro. I have a whole set of stuff imported to gmail with folders, so the ability to type a couple of letters then tab expand (a la bash) to the point of ambiguity would be great...
I also had omalley73's problem exactly for the last few weeks; I then removed the script (right click the monkey, choose Manage Scripts, uninstall Gmail Macros), refreshed my Gmail page, reinstalled the script, refreshed my Gmail page again, and the problem seems to have disappeared.

This may be the "fix" or Mihai may have just fixed the bug in the latest version.

Hope this helps someone.
This is just an FYI for all the GMail lovers. Most of you must already know, but if you don't, GMail has introduced quite a few new features under it's 'Labs' experiment. Checkout the 'Labs' page under 'Settings'. I am sure you'll leve these!

My favourite is 'Quick links'; just another incarnation of 'Saved Searches'; something have been asking for so many months here!

Go enjoy.
In FF3 for OSX, gmail macros behave... weird. It looks like they don't start up every time gmail is visited, they only work in 3 cases out of 5.

It's pretty indeterministic, and I cannot find any reliable way to reproduce it :(
for Dan Nugent - I'm guessing the second unread means unstarred
For me as well, the gmail macros by which love - doesn't always work every time I startup Firefox 3.

The Better Gmail2 macros is nice, but it doesn't seem to have the 'label' feature, where you hit 'l' and then can type the name of archive you want the archived message to go to.

Also, when i try to type in this comment - i'm using firefox 3, the below 'captch' shows up as empty/blank, so I have to use safari to write this.
The 'Goto label' shortcut 'g' collides with googles own 'g+(someotherkey)' shortcut and breaks it.

I suggest using 'G' instead for 'Goto label'
I have the impression that in better Gmail 2 currently the macros don't work with https but only with http.
Like others here, for me typing 'l' to label something doesn't work. Nothing happens as far as I can tell, and that's sad because this would probably be the thing about this script I would use the most. Any ideas anyone?
Hi Mihai,

I absolutely love this script! The one catch I find is with the automatic applying of a label when a match is found.

Is there a way to make it require that I hit return to apply a label?

Here's the problem:

I have a label called "house". So I hit "l" and start typing "house". Super Cool!

The label is applied automatically when I type "ho" because "ho" is a unique match for "house" out of all my labels at that point.

But my fingers keep going because I can't keep all the unique match character limits straight in my head. "ho" for "house", "gar" for "garden". And it changes when I add new labels.

Then a bunch of weird stuff happens because all of the remaining characters in "house" those being "use" are treated as keyboard shortcuts.

All of a sudden my label is applied and gmail is doing all sorts of crazy stuff.

u = nothing, but I swear I hear gmail ululating
s = star
e = archive

What I really want is:

1) for gmail to stay calm. No suprise ululation.

2) Let my fingers keep going and let me decide that I have the label I want.

3) let me hit return and then have the label applied.

This script is a stroke of brilliance. Thanks for creating it!

Is anyone else still having trouble with this? I can't get mine to work currently. If I press L, most of the time the label window doesn't come up. Every once in a while it will, but after it shows it wont accept keyboard input (press L, label window shows, type "O" and it opens a message instead of typing O in the label window, etc).

Is this script just broken for now?
I finally broke down and made a slight change to the script so that it does not auto apply labels as soon as there is a unique match.

Instead, you have to hit "Return" in order to have the label applied.

A description of the change and a copy of the script with the change are available here.

I find that the Gmail labs feature "Right Side Labels breaks this script. If you turn that one labs feature off this script starts working again.

Hope that helps.

Paul: Thank you so much for that update! I've wanted it to change ever since I saw that suggestion, so I'm going to try your script and see if it works for me.

Also, I figured out my problem; if I switch profiles in Firefox, it breaks gmail macros. I have to clear the cache and reload gmail and then it works. Totally strange, but there you go. So I finally have macros working again.

Also, paul: the link to your script is broken
Thanks James. I fixed the link. Some very strange things are happening with my web server.

Anyway this is the correct link to the script.

For what it's worth, the change to update the script was very simple.

Line 350 changes from
if (event.keyCode == 13 || selectedLabels.length == 1) {


if (event.keyCode == 13){
@bdbest I had no problem using forward slashes using Paul Russells latest script. indexOf() should have no issues with forward slashes.

I did, however, run into problems combining his script with GTDinbox. GTDinbox redoes the label box and labels that macros reads are split erroneously by forward slashes (IE macros reads "Waiting On" instead of "S/Waiting On"). I'm looking into a solution for that.
@Paul Russel: Thanks a ton for that trick.... I have been a victim of accidental 'archiving' and 'trashing' for long. Not anymore.
How about something for sorting gmail messages alphabetically by subject?...

How about something for searching with an asterisk * wildcard ?...

How about something for searching by the initial characters in the subject line or in the author from line?...
Gmail just changed their interface again today, so labeling with Macros doesn't work again.
To poster above - they've implemented the same thing themselves. I definitely prefer the Quicksilver interface, and functionality isn't quite as good (you have to press enter for the label once it's selected) but it isn't bad.

I'd love a version of this that would either override Google's own labeling, but as long as I can still have the d command for mark as read & archive, I'll live. But I cannot live without that!
Labeling works, but going to a label doesn't.
I just want to add that I appreciate your work on Gmail Macros, and I also think the interface Gmail Macros provides is better than the new labeling interface within Gmail. (It looks more like Reader)

Please update your script!
Going to a label is my favorite feature!

I turned on the Go to label feature in Gmail Labs, but... it just isn't the same.
I am new to the idea of greasmonkey and scripts and stuff, but from what I gather greasmonkey stores .js scripts that alter the way firefox interacts with websites... I think.

so yeah this is cool but I tried invoking some of the commands in my gmail account and they don't work. It draws a blank. I have the script installed and I have it enabled. Is there something else I may be missing?
It's seems don't have a hotkey to "Download" attach file. Some screen readers can't read this Gmail feature. The blind people thanks in advance for some help.
I like this script, but it's not work.
So, I customized (remaked) Gmail Macros and released at Gmail Macros for Greasemonkey.
Of course, "Go to label" function is active. And, "l (small L)" acts as "Apply or Remove label".

Post a Comment