A Greasemonkey Christmas #

Update on 1/23/2006: The label colors script exposed a XSS vulnerability. It has now been updated to remove this hole - all users are encouraged to install the latest version of the script.

After many delays, I've finally gotten around to updating my Greasemonkey scripts so that they run under Firefox 1.5 and Greasemonkey 0.6.4. In fact, these scripts will most likely not work in older versions, and I will not be supporting Firefox 1.0.x or Greasemonkey 0.3.x.

Conversation Preview Bubbles (script) was the most straight-forward, since I had already done some work to make it compatible with the unreleased Greasemonkey 0.5.x releases. In fact, it seems to work better under FF 1.5/GM 0.6.4 - before the script did not trigger for label and search results views, but now it does. Saved Searches (script) required a bit more work, and in the process I decided to clean it up a bit. The result count functionality was removed, since it was not that useful. The fixed font toggle feature was spun off into a separate script since it didn't make any sense for it to be bundled.

Gmail macros screenshot I'm also taking this opportunity to announce two scripts that I had previously written and never gotten around to releasing. Gmail Macros adds additional keyboard shortcuts to Gmail. Some are obvious (and have been done by other scripts) such as "t" for move to trash and "r" for mark as read. However, I strove to provide a bit more functionality. For example, "p" both marks a message as read and archives it, when you really don't want to read something (the "p" stands for "purge"). Additionally, the shortcuts can be easily customized by editing the HANDLERS_TABLE constant. More than one action can be chained together by providing a list of action codes (which are contained in the script and were extracted by looking at the generated "More Actions..." menu in Gmail). The other novel feature is for label operations. Pressing "g" brings up a Quicksilver-like display that allows you to begin typing in a label name to go to it (special names like "Inbox" and "Trash" work too). Similarly, pressing "l" allows you to label a conversation with the label of your choosing.

Gmail label colors screenshot The other script is Gmail Label Colors. In the much-quoted Walt Mossberg article on Gmail and Yahoo Mail, he claims "Gmail doesn't allow folders, only color-coded labels." Ignoring the folders vs. labels debate for now, this sentence is not actually true, since labels in Gmail cannot be color-coded. This script adds that functionality, since it turns out to be very useful (if used sparingly, otherwise too many colors can get overwhelming). To specify a color, simply rename a label to "Labelname #color" (e.g. to make the label "Foo" be red, use "Foo #red" and to make the label "Bar" be orange-ish, use "Bar ##d52"). It works in a similar way to the conversation bubble script, in that it overrides the JavaScript function through which Gmail receives data. It has to jump through some hoops to avoid the HTML escaping that Gmail does; intrepid Greasemonkey hackers may want to look at the source.

If you're wondering why so many of my Greasemonkey scripts are Gmail-related, it's because it's the application where I spend a significant part of my day, thus every bit of productivity improvement counts. Not only do I use Gmail for my personal email, but I also use an internal version for my email needs at Google (as do most of the other Googlers - this constant dog-fooding helps to make Gmail a better product).

(the usual) Disclaimer: I happen to work for Google. These scripts were produced without any internal knowledge of Gmail, and they are not endorsed by Google in any way. If you have any problems with them, please contact only me.

265 Comments

mihaip++
I can't live without the preview bubbles.
Awesome, the ability to trash a message using keyboard shortcuts as well as the 'Quicksilver' like dialog box for lables is just out of this world

Merry Christmas & a Happy New Year :-)
Thank you very much for updating these scripts. I was seriously missing the saved searches under FF 1.5.

One thing: I personally did like the result count on the saved searches. How difficult would it be to add back in?
In the labels list the color still shows (the stuff after the #)--is this intended? cause its kinda annoying to me.
the quicksilver-thingie doesn't work so well when you have label xyz and label xyz-admin... there is no way to go to xyz
I can't seem to get the non-specific colors to work. e.g. using your example of "BLAH ##d52" doesn't color the label whereas "BLAH #red" does.
Also, can you embelish a little on where you're getting the code d52 from? I am familiar with 6-digit colors only.

Thanks
Caleb, yes it's true that the labels list still shows the colors. Unfortunately there wasn't anything that I could do about it when I tried.

Luka, I've updated the script so that hitting enter will use the first label that matches, so you can just hit that key after entering "xyz" (the key code works on Mac OS X, not sure about Linux or Windows).

Alex, the 3-digit colors is a shorthand: #abc gets expanded to #aabbcc and so on. Not sure why it wouldn't work for you. Make sure there are no stray spaces.
Love the gmail label colors! However, I didn't like having to add the suffixes to each label, especially since they show up on the "folder" list as well and would shift off my number of unread messages for the label.

But it was very easy to change the routine to hard-code my own colors. For example:

function getLabelColorInfo(rawLabelName) {
switch (rawLabelName) {
case "I-CANSLIM": return {name: rawLabelName, color: "green"}; break;
case "I-Investing": return {name: rawLabelName, color: "blue"}; break;
default: return{name: rawLabelName};
}
}
Seems that conversation preview bubles doesn't work for messages in the SPAM folder (it's not a huge deal).

Thanks so much for all the scripts! they're awesome!
Would it be possible to allow me to show small photo portraits (if I have them) of people who email me?
Great scripts however I tried to remove a colored label from an archived message and couldn't, I belive the color tags get passed on to gmail function.
Also it would be nice to hide the #color from the label list!

Regards.
hi, i have FF1.5 and GM.6.4 and i can't get conversation preview to work. i installed script a few times and relaunched FF each time. any ideas?
awesome! The scripts make Gmail more powerful.
Hi, how to change in GMail Macros shortcut for "Move To Trash" from "T" do "D" key?
I tried changing script with notepad, but it didn't work.
Any ideas?
thanks
Jason, perhaps you have stopped javascript from playing with the context menu, it's somewhere under options->advanced
Personaje, those are the trade-offs of the approach I chose. You can try using the method Randy describes in his comment. That won't have those issues, but you'll need to install the modified version of the script wherever you use Gmail.

KoreV, the key code for 'd' is 68, you can try changing line 49 to that instead of 84.
Great stuff, and quite nice for my favorite email service.

One addition that I would like to see for gmail (or added via a greasemonkey script) would be archive and go to the next message, and archive and go to the previous message. Likewise, doing a trash this message and go to the next one would also be helpful.

I frequently have 8-10 emails, several of which are generated automatically by my server, and I just need to review last night's data and then can trash the mail. It's slow to keep going back to the inbox and then pick off the next one with a mouse click. I run a Squirrelmail installation and really miss these functions (which are part of Squirrelmail).
How difficult would it be to add support for mass checking to the macros?

I tend to read through a set of messages and when I'm done I select them all and archive. I was planning on figuring out how to do it myself but you've saved me most of the hard work. I'm thinking ma (mark all), mu, mr, ml.

Also, is there some sort of rough programmer's reference to gmail or does everybody writing greasemonkey gmail scripts reverse engineer it themselves?
Karl, it shouldn't be that hard to add those shortcuts. If you can get a hold of the DOM nodes for the Select All/None/etc. links, you can use the fakeMouseEvent function from my preview bubble script.



I don't think anyone has written a reference to Gmail script writing. I usually use some combination of the DOM Inspector[1], JavaScript Shell[2], Web Developer Extension[3] and the handy "View Selection Source" command from Firefox's context menu.



[1] http://www.mozilla.org/projects/inspector/

[2] http://www.squarefree.com/shell/

[3] http://chrispederick.com/work/webdeveloper/
These are great and a huge help, nice work!



Tip: I also made a Persistent Search that was simply an email of your Gmail Macros list. So, i can quickly reference those shortcuts.
can someone advise me in layman terms how to install the conversation bubble script correctly. running ff 1.5 and greasemonkey .64....thanks!
Thanks Mihai, it help.
Great Job about all this.
Marry Xmans and Happy New Year!!!
So if I install the macro's script, I no longer can use the default shorcuts like
ga
gs
gc
gd
gi

Too bad :(
Jack, those still work, except you may need to type in more of the name if you have label names that conflict (e.g. if you already have a label whose name beings with "i", you'll have to type more of "Inbox").
I've added the select macros to the macros script. I also moved the read and archive key to D (discard) since P conflicts with move to previous message in conversation view. I was too lazy to to select by label.



Script:

http://gr.ayre.st/~grayrest/greasemonkey/gmail/gmail-macros.user.js



Patch:

http://gr.ayre.st/~grayrest/greasemonkey/gmail-macros-select.patch



I'm happy now.
I lied, I wasn't happy. Added key command summary with ? and changed o from the useless duplication of enter to expand/collapse all in conversation view.

Same urls as before.
Go to Contacts doesn't work :-(
how can I edit the script,
thanks
Is it just me? Seems like the only greasemonkey script I can run is the one that adds the delete button to Gmail.

I have tried running the above scripts and my Firefox 1.5 crashes constantly. I really like the label color script, but I can't stand that Firefox crashes every 10 minutes or less.
I love the Quicksilver functionality, but as it is it only searches the labels when the label tab is open. Would it be possible to also search the labels when it is closed?
I just wanted to say thank you for your work. I use these scripts all the time.
I too, would like to point out that removing colored labels does not work. I have to rename the label (without the #) in order to delete a label from a message. I'm sure this is somewhat of an easy fix. Hopefully that can be updated soon. Thanks!
hi, is anybody was thinking about making preview bubbles for news at Google HomePage.
It'b be usefull.
I don't know how to do it, maybe i can receive advice about doing it.
Thanks
Any reason this would not work on a mac? I'm not having any luck although I can get it working on a PC.
with all of your scripts installed, on windows xp sp 2 with firefox 1.5 and greasemonkey 0.6.4 it will crash firefox if you attempt to open up two tabs with gmail (which i often do).
Steve, I do all my work on Macs, and the scripts work everywhere. There may be an issue with Greasemonkey, I have seen it get confused when a profile was migrated to Fiefox 1.5. You can check the JavaScript console for any errors of that nature (they will show up on all pages, not just for Gmail).
Hi
I found the label color and quick silver very useful
thanks a lot.
i installed preview js but whenever i right click i am getting the standard right click menu .
Could you try to make a script which will allow user to attach a note to mail?
I think we can use a mail to make a "note" a script which will tigger a mail to self with the same subject will keep that new mail attached to the conversation.
thanks
sam
When using FF 1.5, the latest GM, and Windows XP I get this error trying to install either script:

http://jeremy.zawodny.com/i/gm-error.png

Any ideas?
I too have a problem removing a colored label. It appears like color labels show up COLORED under the "Remove" in the drop-down box even though they are NOT colored (that is, they have their #codes after them) under the "Apply". So when Google tries to remove a label, it tries to remove the label WITH its HTML color markup. It can't find these labels, so the labels never get removed.

So that seems to be a bug.
Jeremy,
I had the same error. Do you have the Firefox Gmail Delete extension installed? I read somewhere it doesn't place nice with Greasemonkey. I removed it and now could install the scripts fine.
Thanks for updating the scripts... but I can't get the conversation preview to work under FF 1.5 GM 0.6.4 in Linux. Works great in Windows though. I checked my javascript options, and it is set to allow scripts to disable/change the context menu. Any ideas?
hello. thanks for the useful and beautiful scripts you put in the open. i also like to have back the result count on the saved searches. do you think it would be difficult to have it back? eventually, can you give some instructions on how to do it? thank you! --luigi
Nope, I don't have the delete extension installed.
Jeremy, the error message you get is mentioned on this troubleshooting page:

http://greaseblog.blogspot.com/2005/12/troubleshooting-064.html

It may help.
Hope this isn't a dumb question, but... is there an UNlabel function built into the Macros script? Like, if you accidentally apply the wrong label with your handy "l" shortcut, and you want to remove of it without resorting to that damned dropdown menu..?

That said, LOVVVVVE the script.
Great scripts. I'm so glad that you got the previews working with Firefox 1.5.

A couple of points though.

I agree with Not Shitashi that the labels thing takes a bit of getting used to. It's so easy to just type in the wrong thing and suddenly it selects that one and, OMG where did it go?!? ;) Ideally, could the Quicksilver thing show a list of labels that match the text that you type in? So for example, I have a label that says "Google", and another for Gigs And Tours. If I type "G", then it'd show those two (and perhaps a third option for "Create New Label") in a list, allowing me to select one. Or alternatively, just requiring me to press enter after typing the label name would be good too.

Secondly, I noticed a possible bug in the previews script. If I right click a message that has HTML in it, WITHOUT selecting it first with the tickbox, the preview window appears very tall and thin, meaning I have to scroll horizontally in order to read it all. I managed to test this with emails from BOL.com and theonion.com.

I'll have a look at the script for the labels one to see if I can make it need an enter to close.

Anyway, cool scripts. Cheers
I've changed a bit of code in the Macros script:

Basically, what was causing the quicksilver window to disappear as soon as it found a match was that it was calling the endLabalAction as soon as selectedLabels had more than 0 elements OR someone pressed enter.

I've removed the check for 0 elements so it now waits for you to press enter.

function updateLabelAction(event) {

//...snip...

if (event.keyCode == 40) {
// Tell the user what we picked
banner.update(selectedLabels[0]);
}
// We don't invoke the action straight away, if the user wants to keep
// typing and/or admire the banner
if (event.keyCode == 13) {
dispatchedActionTimeout = window.setTimeout(
function () {
activeLabelAction(selectedLabels[0]);
endLabelAction();
}, 400);
}
}

You can press the down arrow to show the match, and up to get back to what you were typing. That's what the check for keycode 40 is for. I'm actually in two minds as to whether it should just show a match as soon as it finds one, so if you want it to do that, just remove the if (event.keyCode == 40) statement.

Anyway, now I'm a lot happier. Thanks
Oh, sorry for the triple post, but there's one more thing. In the Recent Searches bit, if there was an option to save that search permanently, that'd be great.

Cheers
mihai, great scripts!

Karl, I like your changes, but I have some issues. "?" doesn't do anything for me (on Mac, haven't tried on other platforms). Also, with your changed macro script, when hitting "/", it focuses the search field, but also adds "/" in the field. This doesn't happen with mihai's original macro script.
As for the crashes, seems that the Macros script is exposing a Javascript bug. If I disable that script, FF no longer crashes.
The go to label shortcut (g) conflicts with GMail's gi (go to inbox), and is very annoying. I had to manually comment the code for it from the script.

But absolutely a must have set of extensions! Keep it coming!
All my GMail scripts broke this morning. I'm not sure if it's Greasemonkey gone mad (for some reason, the yellow bar prompting an install didn't appear on any of them, but the Tools>Install This Script menu option did), though I've uninstalled and reinstalled it - though it kept the settings and I don't know how to purge them.

It could also be another of my extensions since I updated a couple. DuplicateTab also broke but worked fine after reinstalling.

Finally, it could be some change in GMail that stopped all of them from working.

Anyone else found this issue?
Update: Seems to be GreaseMonkey doing something strange since other scripts that I installed just as a test for other sites don't work either.
(another) update: It's caused by an update to Google Toolbar - 1.0.20051122. I don't remember that installing an update this morning but maybe I'm just mistaken...
I didn't see any of the most recent errors that other's have seen, but I've gotten errors and stopped using the Label Colors script, because it was crashing Firefox almost everytime I would open Gmail.

I appreciate all of the hardwork to make these scripts. Even though I had problems with one of them, the others seem to work fine.
Hi,

I'm a newbie to scripts. I've downloaded the latest Greasemonkey and FF and the scripts, I can't replicate the colored bubble labels on the second pic ("Receipts" in red and "persisten.info" in beige). I've read the article and skimmed the comments with no success.

Help?
Greasemonkey and these scripts (search and macro) lead to a Gmail "lockdown." Gmail auto response says to disable Greasemonkey. Too bad. I quite liked this.

From "gmail team "...- using certain browser extensions that change the behavior of a website
(Greasemonkey, a popular Firefox extension, often interferes with Gmail.
We suggest disabling Greasemonkey to use Gmail without any issues.)
For your protection, we ask that you disable any non-supported software
before accessing Gmail again."
Karl G, great modification to the original script. I love the ? popup and the mark messages commands. With the 'o' to expand all in conversation view, there seems to be a focus bug. Hitting the 'o' works as promised, but then the focus goes into some strange mode, all navigation (arrows, pgdown) stop working requiring clicking on the page to refocus. Ideas? Using ff 1.5 on xp
Karl G, to elaborate on previous comment:
When using O to expand all in conversation mode a bug seems to occur that traps the focus. I often have really long conversations (one of the great features of gmail) and it is nice to have your shortcut to expand the thread. When just clicking the Expand all/Collapse all, the navigation keys work fine (try clicking expand all and then using pgdown. at this point gmail shortcuts work fine too). When using the O key to expand all, the navigations keys stop working until the focus is properly restored. With my limited investigative powers I discovered the following. Clicking on the little colored box in the lower right corner fixes the problem. I can then use arrows and pgup/down to navigate. It seems that perhaps the conversation view has something that is trapping keys and makes it so your fakeMouseEvent doesn't work quite right. Thanks for any insight. I am looking into the code now, but I am very bad at DHTML stuff and javascript.
Thanks for the macros. What I'd love is one that would send the message I'm currently editing. Is that possible?
chrispix, I just hit tab and enter. 2 keystrokes yes but still fast.
what about preview bubbles for WebClips?
Thanks, I always forget that there are buttons right below the edit area.
Nice work. The label coloring is so helpful for my action items (email).
Is there a way to open the selected message for reading? I guess it would cause problems if you had more than one message checked, but I'd really like to be able to tab to a message, check its box, and open it. Or even better, tab to the subject and hit enter to open it.
Has anyone else noticed that the macros work in the attachment filename for replies only ?
chrispix, if I understand your question correctly, you may want to refer to the keyboard shortcut list on gmail help
https://mail.google.com/support/bin/answer.py?answer=6594
the regular shortcuts should suffice.
The macro script is great. I had the "delete" button, but this one is way beyond. I love it.
I have one query. In the gmail-macros.user.js, I can see "REMOVE_LABEL" const, but not it's usage anywhere in the script. How to give a shortcut for it ?
Anand, the REMOVE_LABEL command is meant to be combined with a label name. It's very similar to the APPPLY_LABEL command, which the script uses already.
Yes, that's exactly what I was looking for. Thanks!
Thanks Mihai, but I could not get my intention done. I am rephrasing my query with an example.

steps:
1. inbox is opened
2. by keyboard, i mark some mails with 'x' key
3. then use 'l' key to lable them
4. hey ! I labled them wrong
5. ok no problem as they are still marked
6. I press again 'l' and select same lable, to "UNLABLE" them,
7. this I intend to do, but they are not unlabled

query:
what key shd I press to unlable them ? pl note that I am at inbox still and 'y' key will archive them.

This macro script has helped me a LOT, as I am a keyboard feak, but this one seems to be eluding me.
I still can't get the "gmail fixed font toggle" to work. There is no button to be found.
I am using Firefox 1.5.0.1.
Help ...

(I used to edit userCSS directly, but was told that your script is much better.)
Budi, 'fixed font toggle' will show as a clickable
'Toggle font' text on right side below 'Expand all' in message view.
Jeremy,

Any chance of getting you to update your bloglines to del.icio.us greasemonkey script? I just found it last night and it doesn't seem to be working. I assume it's because of the same greasemonkey upgrade. Or are you going to tell me to go use Google Reader?

Thanks for the cool scripts.
Whoops. I wrote Jeremy and meant Mihai. A thousand pardons. Not enough coffee this morning. :)
Bug report:
Gmail Label Colours
Firefox 1.5
Windows XP Pro

In any mailbox (not in message view), when a message with a coloured label is selected, the "More Actions..." Menu, under "Remove label:", has the label's name option coloured. (This is actually nice.) The problem is that when it is selected, the message at the top reads (as an example):


The label "Debate" has been removed from the conversation. Learn more


but the label is not removed. Hope this helps. If you need any more info, email me at [email protected]

Thanks for all the great extensions.
Hmmm, ooops, it striped my tags:


The label "Debate" has been removed from the conversation. Learn more
Sorry, one more try:


The label "[opentag]!-- f4ec7d7f501a61a5-108fa49449e NES --[closetag][opentag]span style="background: #900" class="colored"[closetag]Debate[opentag]/span[closetag][opentag]!-- f4ec7d7f501a61a5-108fa49449eNEE --[closetag]" has been removed from the conversation. Learn more
Awesome. Just what I was looking for.
I completely abandoned GreaseMonkey after my GMail scripts (only ones I used) - were consisitently broken. This is just TERRIFIC news and a the entire reason I'm about to re-download GM.

Thank you soooo much for this GREAT functionality!
I absolutely love the gmail macros script... but it seems to crash firefox (linux) every 5-10 minutes. I know that others have had this problem... but has anyone found out how to fix it or work around it?

Thanks a million!
Daniel Cazzulino: The conflict between the "go to label" shortcut and GMail's gi can be resolved by changing the hotkey for "go to label" from "g" to "h" or whatever other hotkey you want. Just go into the go to label definition in the script, and change the number 71 [denoting "g"] to 72 [denoting "h".]

I still haven't figured out how to implement a "remove label" hotkey though. If anyone has managed to do it, please e-mail me or post the solution here.
Avery, that's what I am asking (abt "remove lable"), see post dtd Jan 18, still no answer.
BTW, if you donot make any lable starting with "i", then pressing "gi" will take you to inbox. the latest script has this feature.
The chat history update of Gmail seems to have broken all of these scripts. Can anyone confirm?
Caleb, No such problem found. Scripts are working fine, even in 'Chat' history.
Could someone please enlighten me? I can't figure out how to rename or delete labels in Google Reader after I've created them...
The label functions stopped working for me today, I assume due to some change in Gmail because it happened on two different machines. Anyone else have this problem [perhaps same as reported by Caleb a week ago?] Other functions still work okay.
Well no problem found with FireFox 1.5 and all the scripts. In fact I open both IE (for new Chat feature) and FireFox (for keyboard script) on same gmail id and work fine.
Looks like the date on your update notice is wrong. Unless it's a very old update, strangely predating the article itself.
There is a way to hide the color code in the label name panel?
Not sure what was wrong before but they work on this firefox installation.
D'oh, I still had 2005 on my mind when I wrote the update. It should be fixed now.
gmail macros stopped working for me, I think it coincided with the release of chat. It doesn't work in startard and standard with chat views. Here's hoping the fix is easy! :)
Have Gmail changed something today ? I've isolated this script as crashing my Gmail - been working fine for ages [firefox 1.5.01 GM 0.6.4]
Conversation Preview Bug Alert:
If you read the first message in your inbox, and send a reply, then return to the inbox, right clicking for the preview bubble on the second message brings up the reply to the first message. Right clicking on the third message brings up the second message, etc. If you refresh Gmail, everything goes back to normal.

Thanks for all the great extensions, hope this helps.
Hi,
I am unable to use the Gmail Labels from today morning ? The quick silver doesn't show up even when I press "g". Is something changed, can you fix it. Got so used to it, I am unable to use gmail now :(

Cheers,
v
The Gmail Macros script doesn't work any longer for me....is there any way we can get this fixed? I had become so used to using the keyboard to manage my email.....
I'm in the same boat - just stopped working this morning - ahh! The Macros script have become SO important to the way I work - I'm *really* hoping someone out there knows how to knock this out! :)
I'm in the same boat - just stopped working this morning - ahh! The Macros script have become SO important to the way I work - I'm *really* hoping someone out there knows how to knock this out! :)
If it gets updated, hopefully someone can also provide an update (or explain how to patch) KarlG's version?

and Going to Chats... ooh, that'd be icing on the cake
Hey, what happed ? Gmail macro not working ! Firefox 1.5 Greasmonkey 0.6.4 !!
Any help how to enable it.
Amazing how reliant one can become on a simple keyboard-shortcut script...

And yes, it stopped working for me too. I'm completely lost.
Here's a simple fix that worked for me.

Find/Replace "tamu" with "tam" (%s/tamu/tam/g)

Or here's a patch [http://www.christilden.com/gmail-macros-fix20060316.patch].
Chris's fix worked for me, too; and I was desperate. Thanks, Chris!
Yep, the find and replace worked - thanks a lot, Chris! I was starting to wonder how I could ever go back to life without! :)
Thanks a lot Chris, I love gmail macros.
Chris, you are GREAT ! I was feeling disabled without the macros. And yes my chat was showing disabled, that too is enabled now !!
Weird - looks like Google switched it back to "tamu" - I think I may just save a separate copy of each and enable as appropriate if they keep changing it.
Adam, same here.
Old habit, always keep backup, saved. BUT why google doing this ?
Apply this new patch to Mahai's original script. It will then handle either scenario and you'll only need one copy.

http://www.christilden.com/gmail-macros-fix20060318.patch
I am trying to add an "Unread" function.

I want to use 'Q', so I added
--> 81: [MARK_AS_UNREAD], // Q: mark as unread
to the cont HANDLERS_TABLE.

The script comes with the predefined const MARK_AS_UNREAD = "ru". But this is not working.

Thoughts? ideas?
I've tried the same modification - would love a button to mark items unread! But I ran into the same trouble as Michael. I would forever be indebted to (or at least praise this person from the hilltops) anyone that could provide the unread button on Karl G's modded version of the script, along with re-enabling the O button for opening messages! ;-)
You just need to change MARK_AS_UNREAD constant's value to "ur":
const MARK_AS_UNREAD = "ur";
The macros script has been updated:



http://persistent.info/archives/2006/03/21/gmail-macros



Go there!



I've updated my macros script to the new version (patch was clean, how nice!).



I've additionally gone through the requests. I can't help the ? not working, it's worked for me on all platforms in the past three months.



For the other concerns, the help info now should position itself towards the top of the screen, I've added a 'v' macro to mark as unread ('q' is taken by focusing on quick contacts). The 'o' expansion now returns focus to the conversation. I believe that addresses all the concerns.



If you want to remove my 'o' command, do a search for '79' and comment out that block (8 lines in the updated file). I will not remove it because enter does the same thing and I actually use the expand all quite often.



Link is still at:

http://gr.ayre.st/~grayrest/greasemonkey/gmail/gmail-macros.user.js
These are amazing scripts! Thx so much.

A couple of questions:

1. What's the "9000" after the "Label Selector" text when I hit the 'g' key?

2. I can't seem to get '?' to work to pop-up the Available Key Commands window to pop-up. Is that something that needs to be manually configed?
Absolutely amazing scripts. I have an offer, coupled with a request:

I will wash cars, shine shoes and clean houses if there is any way you can help get label colors incorporated into Gmail as a standard feature. That is one of THE most useful features that I think would benefit every Gmail user, as the human mind responds to and distinguishes color a lot faster and easier than trying to track down a piece of text in a list of 25, 50 or 100 messages.

Thanks again.
Is there any documentation for these scripts? Im trying to find all available keyboard shortcuts that you get with the macro script but Im not seeing it in this post nor in the source.

thanks
AKahn, the "9000" is just a joke. The '?' feature is available in Karl's version of the script, you'll have to read his comment to install it.
I love the Gmail Macros script but as other people have noted, it seems to crash my Firefox pretty often which is making me sad. :(
Incredible script. I only installed Grease Monkey today, but already doubt I could live without it again.

I'm using gmail to implement a GTD style personal productivity solution similar to that outlined in http://saw.themurdaughs.com/gtd%20with%20gmail.pdf and am making extensive use of saved searches.

My next personal project will be learning js to implement the macros with saved search script, if no one beats me to it.
Karl, u r GREAT !
All macro keys are working beautifully. Mark 'All/None' etc. have made me forget about my mouse.
I made few changes to have the '?' help box show properly in middle of page. Also changed 'V' to 'B' for mark unread, as 'V' is taken by 'View Conversation' script.

Now, can u add a macro key for 'Remove Label' ?
I do it now via (from inbox) : x g y g i
But it will be better if (say) : h
ERRATA (html rendering)
Now, can u add a macro key for 'Remove Label' ?
I do it now via (from inbox) : x g [label] y g i
But it will be better if (say) : h [label]
This extension works great! Except for some reason the ? doesn't display the helpbox anymore. How can this happen? I installed the latest version from your site...
Hi Frank,

Try pressing ? two/three times. It sometime happens to me, but pressing ? repeatedly pops the help.
I am having a problem with displaying the help screen. When I open it, I can only see the bottom two third's of the help window. The remainder is hidden under my toolbar. Any ideas?
Hi Mike,

You can download the modified version from below link,

http://coral.anand.googlepages.com/gmail-macros.user.js

I made few changes to have the '?' help box show properly in middle of page. Also changed 'V' to 'B' for mark unread, as 'V' is taken by 'View Conversation' script.

All credits goes to Mihai and Karl. Hope they add further new features to it.
Anand, that scripts works great! :)

One thing I noted, however, was that when trying to install it, Greasemonkey didn't recognize the script (Firefox prompted me to download it). I believe it is because of the first line, "//~ changes by Anand". I moved that line (and the blank line after it) to after the line that says "// ==/UserScript==" and loaded it up into my browser. Greasemonkey recognized (and installed it) without a problem.

And now I'm a happy GMail Macros user! Thanks very much!! :)
Thanks OZ, though I did not had this problem here, anyway I will move that line below.
Since a couple of days ago, the Gmail Label Colors have ceased to function after I leave my Gmail page open for a while. When I first open Gmail or if I do a complete refresh of the page (F5), the colors are back. However, after a while Gmail autorefreshes the page, and I lose the coloration. Macros work fine. Any ideas? Thanks!
yeah, I am too facing this prob. now !
Any progress on the Color Labels? It really kills the experience of browsing Gmail when it is only blue and green! Anand, you seemed to be able to fix the Macros script, can you do anything with this? Or can someone tell me how to do it myself?
I want to use Karl G's thing. For that I need to install the script and then patch it, right? How do I patch it?
Hi Ben and Michael,

I could not fix the color labels problem. Though I use it to my benefit, for unlabeling a mesg by dropdown list ( it works when colors are not showing :) )

Michael, you do not need to patch anything. Just install latest Firefox and Greasemonkey. Then download the script from this site or from my site as below,
http://coral.anand.googlepages.com/gmail-macros.user.js
i edited the gmailmacros.user.js file to change one of the shortcut keys, but it did not take effect. (changed "U" to "I" for go to inbox). the old shortcut still works and the new one does not. what am i doing wrong?
Hi,

I like your label colour script, but there seems to be a bug.

I'm unable to use the "remove label" function from the dropdown menu if the label has a colour assigned to it.

I'm able to use the remove label button though.
great scripts! just wanted to show my appreciation.
One tiny suggestion for improvement. I added the following line in endAction() immediately following the if statement:

labelInput.blur();

The reason being that I use the spacebar to jump up and down the page and after using one of the select actions the input seems to still be trapping the spacebar somehow.

Are there any plans for creating macros for the older oldest newer newest link buttons?

Cheers.
I'm unable to install the labels script. i keep getting an error message from the browser. this isn't happening with any other scripts. i am running ff 1.5 and GM 0.6.4.
Well, I was just thinking why Google searching history does not include gmail search, now it does, thanks to persistent search script! Thanks a lot!

http://johnvey.com/features/gmailapi/
What about using your "l" macro for Saved Searches also? I have a Search for Unread messages and that is what I use most of the time. Thanks. Good work.
Hi,
I just wanted to say thankyou so much for the amazing scripts, and also put in a couple requests... This is kinda like my gmail wishlist, and I'm wondering if anyone else is wishing for similar developments:

>Can anything be done at the greasemonkey level to improve browsing/management of the contacts folder? Currently you cannot select contacts via keyboard shortcuts, and once you are inside a contact's details, there is no option to move to the next/previous contact of the found set. As well, any features which could help create some kind of databasing via keywords within Contacts would take gmail to another level.

Thats all... anybody have some thoughts?
Thanks again for phenomenal scripts... my productivity is about to increase exponentially!
nate
Just wanted to throw in my own thanks for the macros script. I've been using for several months now and...wow. How did I ever get along with out it? And, to top it off, I was getting tired of clicking between labels and just today found that I could do it with "g". Outstanding. What took me so long to RTFM as they say?

Fantastic scripts. Thanks.
Okay, so as much as I love Gmail Macros, I have a question: Is there any way it could be updated to include handlers for "Select All", "Select None", etc.? That's the last step that just might allow me to forget about my mouse all together. :-)

Just wondering.
del key short cut is SOOOOOOOOOOOOOO useful! thanks guys
Hi, thanks for the scripts!! I love using it. However, I'm getting confused which shortcut you're using and was wondering if you can compile a shortcut sheet like google?

thanks again!
Wow, great scripts! Some suggestions:

1) "P" (purge) gets in the way of "n"/"p" in conversation view (to move among msgs in conversation)! I changed it to ";"

2) I think this would be revolutionary: ability to take action on the item AT THE CARET without having to "X" it and without interfering with whatever *is* "X"'d...Perhaps +key could accomplish this. Examples:

===Message list view===
+T: trash conversation AT CARET
+E: archive conversation AT CARET

===Conversation view===
+T: trash message AT CARET
+E: archive message AT CARET

Know this would be more of a challenge but you've gotta admit it would be useful!

Thanks again,
Aaron
Hi Everyone,

Good news. Now gmail-macro supports "Remove Label" short-cut.

"B" = Remove Label
"V" = Mark UnRead (as was done my Karl)

The latest script available at:
http://coral.anand.googlepages.com/gmail-macros.user.js

Hope all macro lovers find it more useful now.

Anand
I have GTDGmail installed (www.gtdgmail.com). Gmail Macros Quicksilver-like features work fine for labels like "stuff" but it wouldn't work for the prefixed version, "P:stuff".

Besides, Conversation Preview Bubbles doesn't seem to work at all.

Any idea how to fix all this?

MK
Hi Everyone,

Mihai had done the job of marking the "Remove label" id but somehow he did not put the codes around. Karl also missed it. It took me some time to figure out how to use the "Label" codes to "UnLabel" logic. The beauty of the script is that it works on color coded labels, even when colors are visible (a feature most of us were requesting for long).

Anand
Astounding ! I never thought I could customize Gmail up to this point !
Can somone tell me how to delete an open email and go to next email opened? If this is currently not in, then how or where can i add in the script?
Superb! Thanx so much for these Greasemonkey additions for Gmail in such a neat way. Very easy to access and I'm already up-and-sprinting! :D

Ahhh yayzerama for boosted productivity.
Is there a way to open the selected message for reading? I guess it would cause problems if you had more than one message checked, but I'd really like to be able to tab to a message, check its box, and open it. Or even better, tab to the subject and hit enter to open it.
Something I've never understood is why there aren't keyboard shortcuts for selecting "All," "None," "Unread," etc.

How do you handle unselecting all messages w/out using the mouse? Any plans to incorporate something like this in your Greasemonkey script?

Otherwise, great scripts -- improves the usability of Gmail thousand-fold.
Hello,
Thanks very much for the Gmail labels colors scipt. Very very useful! But I have the same problem as Anand, i.e. when the page auto-refresh, I loose completely the colors, until I do myself refresh the page. Any way around this problem? Thanks
Hi Hillary,

The script HAS the keyboard shortcut for Selecting "All", "None" etc., as M+A to mark all. Checkout the script uploaded by me, link given in earlier mail above. You can see the complete keyboard list in help screen by pressing ?.

Anand
Amazing. Seems to have broken the Tab-Enter functionality though. firefox 2.0

When I hit the tab key, Firefox grabs the command and sends me to the search box, and then the enter key causes an empty search string event.

So, instead of sending, I get prompted to either save the draft or discard. Eeek!
@Anand -- thanks for the reply! i did not know about the "?" help functionality.
i'm in the same boat as Amit. is there a way to delete an open message AND open the next message with the same keystroke? basically, "t" + "o" combined, but only when you're in the message-view mode, not in the inbox-view mode (damn, i sometimes wish gmail had a preview pane mode).
I'm in the same boat as Marek Kowalczyk. I have GTDGmail extension installed and I have the same problem with my labels using the label selector; doesn't work at all.

The Conversation Preview Bubbles doesn't work for me either.

Suggestions?
This would be great to get into GMail itself!
Hey Anand, thanks for the update to these macros. I've also updated my keyboard command printable "cheat sheet" for Gmail with these extended macros. It can be found here: http://michael.kizer.ws/2006/04/18/supercharging-gmail
Greetings,

using Gmail Macros with FF 2RC3. All of a sudden "g + label" doesn't work for me, i.e. the label selector shows up, type label, enter, the command doesn't lead me to the desired label.

Any ideas? Anyone else seeing the same?

Thanks a lot!
FRank
Also seeing the label selector stop working (FF 1.5.0.3)
has a fix been found for the issue regarding the auto-refresh loosing the label colors? i love this script. thanks.
echoing frank's concerns... i think google changed a few things.

g + label doesn't work.
m + (a)ll/(n)one/(r)ead/(u)nread doesn't work

haven't found anything else, but there may be others affected.
I have the same problem, but I also switched to Firefox 2, maybe that is the cause?
Google changed Gmail. I'm still using 1.5.0.7 as I have for a while now and some shortcuts are broken for me too. Thus far it looks like only what jay mentioned is broken, specifically going to labels with the G key and marking items with the M key.
Hope someone posts an update to work with FF 2.0

Thanks in advance
Hope someone posts an update to work with FF 2.0

Thanks in advance
'v' in Karl's Gmail Macro makes Gmail Conversation Preview unread Gmail previewed, and do not discard emails, so I have changed the unread key to 'd' and updated the help screen activated by '?'. It should represent the most updated Gmail Macro script found in here and userscript.org.
http://borisyim.googlepages.com/gmailmacrosbykarl.user.js
I meant I do not discard (archive) emails, so 'd' is freed up. Still, the label pop up is not working, so I changed it to use the key 'h' so that 'g+?' still works. Now, the nearly alphabetically ordered keys on keyboard: d,f,g,h,j,k,l are all used, as well as other keys; only 'q' and 'z' are unused. Feel free to customize them too. Thanks to Mihai for such great script which should really be officially incorporated in Gmail to avoid problems when Gmail updates.
BTW, it would be nice to have a feed for the comments here, so that we can track any updates by... Mihai's Google Reader :p
Boris - cannot get your script to open - 404 error. Can you check the link
Another vote for fixing the scripts, specifically the Macros script.

Or better yet: *integrate it.*
Has anyone else had trouble going to a label or inbox? I press g and the box pops up. I type and the name is completed and the box goes away. But then nothing happens.
Excuse me for multiple postings. Given some more thought to the key selection now: same as Anand's version (for those who have been used to the 'e' and 'd') but changed unread from 'v' to 'z' (preview by 'v' and undo read is similar to Ctrl+Z), changed label pop up from 'g' to 'h' (to free up the default function of 'g' until label pop up is fixed), and changed expand/collapse to ('o' better stands for 'open'). The contents, wordings, color, position and size of the help box triggered by '?' and also the "cheat sheet" are updated.

http://borisyim.googlepages.com/gmailmacros.user.js

http://borisyim.googlepages.com/GMail_Keyboard.doc

'm' and are still not working though, and it would be nice to have a key equivalent to pressing the 'discard' button (without going back to the conversation list).
Google changed some things and the original GMail macros no longer work correctly. There are more details in this other comment thread: http://persistent.info/archives/2006/03/21/gmail-macros



Karl has updated his version of the macros to overcome these issues, it can be had here: http://gr.ayre.st/~grayrest/greasemonkey/gmail/gmail-macros.user.js



Also, I've started a Google group for GMail Power Users, to discuss and share tips, scripts, etc. for GMail (it might be a bit easier than searching through all of the comment threads in Mihai's blog ;-) Feel free to sign up here: http://groups-beta.google.com/group/gmail-power-users
Given some more thought to the key selection now: same as Anand's version (for those who have been used to the 'e' and 'd') but changed unread from 'v' to 'z' (preview by 'v' and undo read is similar to Ctrl+Z), changed label pop up from 'g' to 'h' (to free up the default function of 'g' until label pop up is fixed), and changed expand/collapse to ('o' better stands for 'open'). The contents, wordings, color, position and size of the help box triggered by '?' and also the "cheat sheet" are updated.
http://borisyim.googlepages.com/gmailmacros.user.js
http://borisyim.googlepages.com/GMail_Keyboard.doc
'm' and are still not working though, and it would be nice to have a key equivalent to pressing the 'discard' button (without going back to the conversation list).
Errata (due to html):
1. changed expand/collapse to "Enter"
2. 'm' and "Enter" are still not working ('h' too)
As Boris pointed out, "m" (unstarred) is still not working, and is the most important macro for me. If this this could be fixed, that would be excellent.

Thanks!
This same conversation is going on in two different posts on this blog with two different alternate version of the gmail macros script.



http://persistent.info/archives/2005/12/23/greasemonkey

http://persistent.info/archives/2006/03/21/gmail-macros



Has anybody tried both? Are Boris, mkizer, Karl (and Mihai?) collaborating at all on this?
I believe that Karl's mod to the script allows the M and G shortcut keys to work just fine. You can find it in this thread.

I've started a Google Group to discuss this (and any other power user tips for GMail) here: http://groups-beta.google.com/group/gmail-power-users

Feel free to join, chat, upload files, etc.
i just got gmail and your script is very cute. thanks
The latest and corrected macro script, with all shortcut and which works OK now, is available at
http://coral.anand.googlepages.com/gmail-macros.user.js

All praise to Karl.

Press ? for the list of shortcuts.

Anand
Karl's corrected script now working for me - THANK YOU KARL.
thank you for the update. much appreciated, really!

frank
Awesome! Karl you rock!

One quirk so far though: I can't get '?' to bring up any kind of help/list of shortcuts.
help works on my german keyboard pressing shift-7

frank
Hi David,

Try pressing '?' repeatedly. Sometime, help do not pop by press it once.

Anand
How does this g thing work then? I press it and type in a label, but after I hit enter nothing happens.

Also ? doesn't work. I presume this lists the gmacro functionality in full since I haven't seen it detailed in this post.
There still seem to be some issues with the script. The "?" function does not work for me either, not even after repeated hitting. :-) But worse is the GTDgmail deficiency in the label selector. That's really a pity: labels like "S:Next_Actions" will not be recognized. Could it be that the folks of GTDgmail use special label prefixes? BTW, hasn't there been a way to see a popup with all applicable labels?
Hi Deano and Lolo,

Below is the extract from the script help file,

"?" : "Displays this help message"
"T" : "Trash a message or conversation"
"E" : "Archive always/remove from inbox"
"R" : "Mark as Read a message or conversation"
"V" : "Mark as Unread a message or conversation"
"D" : "Discards (Read&Archive) a message or conversation"
"G+label" : "Go to a label (including inbox/star/trash/etc)."
"L+label" : "Applies label to conversation(s)"
"B+label" : "Removes label from conversation(s)"
"M+key" : "Mark (Select) A: all, N: none, R: read, U: Unread, S: starred, T: Unstarred"
"O" : "Expands/Collapses all messages in conversation"

These are above and all of the normal key shortcuts of GMAIL, like "U", "X" etc.

Try disabling any other script and enabling only macro script, and then see if it works ok or not. May be the other scripts are clashing with this script.

HTH

Anand
For the life of me...I cant change the individual labels color. Anyone has some code examples?

Thanks in advance
Hi Jeff,
the label color syntax is,
[label name] [color code]
where [color code] begins with '##' and the rgb color number in html (only the first letter)

so the html code for color blue is '0000ff'
take the first letter for each, u get '00f'

the html color code for the green title 'persistent.info' at the top of this web page is '82CC33', but u can not set it as u will have to write '#8C3' which will be a bit different green.

try,
Bookmark ##00f
which will give blue color label "Bookmark"

HTH

Anand
Hello again. Has anyone been able to fix the problem of disappering coloured labels whern auto-refreshing? Thanks
Gogo
Anand -- As with Jeff, I can't seem to get colored labels to work at all. I have tried naming the labels with the color syntax as shown, as well as patching the GM script to hardcode colors. Any ideas of what else to try? I'm using GM0.6.6 and FF1.5.0.8.

mk
Hi Mkosma,

GM and FF versions are ok and match with mine.
Get the latest "label color" script from
http://userscripts.org/scripts/show/2433
(in case your's has some problem)

Create a label and name it as
"Bookmark ##00f"

Note the 'space' after 'Bookmark' and two '#'s

Label any mesg as "Bookmark ##00f"

GMail shd display "Bookmark" in blue background color against that mail.

Anand
Okay; turns out I did have an older version of the script. The updated one works.

However, when trying to tweak it, I believe I discovered a bug -- one that absent further modification would probably only cause a slight performance hit, if anything.

In the function getLabelColorInfo, the if statement reads as follows:

if(rawLabelName.indexOf(" #")) { ...

Now, at least here, indexOf returns -1 if the string " #" is not found. That means that the "else" is never evaluated. I was trying to hardwire some colors in the else, and had to change the if statement to the following to get it to work:

if (rawLabelName.indexOf(" #")>0) { ...

mk
This script is great. The one thing I'd like to see added is the ability to toggle off all selected messages ("None" on Gmail). I am new to Greasemonkey (just barely downloaded the scripts this morning) so haven't gotten to the point where I can do this yet, but I thought I'd mention it here in case anyone else knows an easy way to do this.

Post a Comment