Updated Gmail Macros Script #
As some commenters had noticed, Gmail changed the DOM node ID it uses for the action menu, which broke my Gmail Macros Greasemonkey script (since that's how it dispatches commands to the Gmail UI). I have now updated the script to work with both new and old IDs.
Additionally, based on my experience developing the Google Reader labels selector, I've gotten rid of a harmless exception that would show up when using the label selector in this script (bug 236791 has more details).
Update on 3/25: The script now also recognizes the "Contacts" section as a destination when using the "g" shortcut.
76 Comments
I've also noticed that the script gmail-label-colors has some problems. For example, in the "Inbox" view, I am unable to remove a colored label from an item. Please try it to see what happens.
Thanks for these scripts!
http://gr.ayre.st/~grayrest/greasemonkey/gmail/gmail-macros.user.js
Thanks for the script mihai! gmail is so much more annoying without it.
Am I doing something wrong? I'm no greasemonkey ninja.
Greg:
As to what you use to figure this stuff out, The main tools are Jesse Rudderman's javascript shell bookmarklet and Joe Hewitt's Firebug extension. I also use the Web Developer extension on occasion and a a whole bunch of Jesse's bookmarklets, but those don't really affect this. I find firebug to be a lot more convenient to work with than the DOM Inspector.
I set a keyboard shortcut for all the bookmarklets (e.g. the js shell is 'shell') and the address bar then acts more or less like a command line. It's very convenient.
Donald:
You were using my version of the script and currently have mihai's installed. Install my version and you'll get the behavior you expect.
http://abcsnaturally.com/gmailmacros.user.js
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. Also changed '9000' to 'Karl_G' in honour.
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]
please post your version, i would like to try. it sounds nice
thanks
http://coral.anand.googlepages.com/gmail-macros.user.js
All credits goes to Karl.
Thanks, I have changed the help box text for mark unread from 'V' to 'B' and have uploaded it, to same link. It is working great.
Hey Karl, when are you going to give the remove_label shortcut key ?
Try pressing ? two/three times. It sometime happens to me, but pressing ? repeatedly pops the help.
// Added this to globals
var closeLabels = false;
// Added this to beginLabelAction ( after line 2 )
if (divs.length == 3){
fireMouseEvent(getNode("nt_0"));
divs = getNode("nb_0").getElementsByTagName("div");
closeLabels=true;
}
// Added this to the end of endLabelAction
if ( closeLabels )
fireMouseEvent(getNode("nt_0"));
thanks for your help
You can try the script from my site as below,
http://coral.anand.googlepages.com/gmail-macros.user.js
It has all enhancements of Karl on mihai's script.
For '?' popup, you may need to press ? repeatedly sometimes.
I tried the updated script as you suggested, and everything seems fine now. Thanks!
I'm running your script and using Firefox 1.5.0.4. 'D' never gets beyond 'marked as read'; I have to then run an additional 'Y' command to have the email archived. Is there any obvious reason why this might be so?
Yes, 'D' does not seem to work for mark-read-and-archive. I tried but could not fix it. It was originaly done by Mihai, may be Karl can help.
I was having the same label "problems" as ben so I hacked the script to open the labels when you press l or g, and then close it when the label action is escaped or completed. It's not terribly elegant, but it works.
#code
#/quote
Thanks man... it works like a charm. And, No, I dont mind if it opens the labels box for a moment.
I think it should be included in the base script and made available fr people to download directly...
BTW... this is my first JS hack, although a copy-paste... ;) but still... :)
Thanks again..
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
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
G+label does not seem to work with these labels.
Any pointers for tweaking?
Thanks for an excellent script!
Pete
event.target gets set to the element you dispatchEvent on. This means that you need to change all document.dispatchEvent to .dispatchEvent. In mihai's version, there's only one document.dispatchEvent and that should be changed to labelDiv.dispatchEvent. The srcElement added in the line above that change isn't needed, so it (and the comment above it) should be removed.
http://michael.kizer.ws/2006/04/18/supercharging-gmail/
http://michael.kizer.ws/blog_upload/2006/10/gmail-macros.user.js
// Action or contacts menus is present
return (getActionMenu() != null) || (getNode("co") != null);
In other news... I think the shift modifiers might be a good idea to kind of keep the keyboard shortcuts consistant.
Karl (and others), I just started a Google Group for GMail power Users (Greasemonkey scripts, add ons, etc.) so people can chat about their latest scripts for enhancing GMail, plus it'll give people a place to upload their scripts for others to share. It will be much easier than continually replying to the comment threads in Mihai's blog. ;-)
The address is: http://groups-beta.google.com/group/gmail-power-users
it is totally bare right now, but I'll be adding some content shortly...for now fee free to sign up and chat away...
Mihai: this script is ESSENTIAL. My life creaks to a halt without it. Okay, that's exaggerating... but please give us a fix!
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?
http://groups-beta.google.com/group/gmail-power-users
We're posting various versions of the script on the group, as well as having a lively discussion.
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. Also try pressing '?' key repeatedly, sometime pressing it once do not work, even in my machine.
HTH
Anand
http://mail.google.com/support/bin/answer.py?answer=47787
"GMailMacros: sewpafly flavor"
I can't seem to access the my Labels.
FWIW- I am running GTD extensions.
Any advice/suggestions?
Thanks,
Sasha
And also, for the first command in help it says "C* Compose" with the C in compose in yellow. So do I need to type C* or C to compose a new message?
PS. Max--Try http://groups.google.com/group/gmail-power-users instead. I'm sure he's quite busy...
Selecting a message and then pressing l for label does bring up the labeling dialog.
Disbaled all other extensions and Greasemonkey scripts... still not working.
The "Gmail color labels" greasemonkey script works fine...
Also tried the Gmail Macros - BN version from the google group... even that does not bring up the help screen on pressing "?"
The help popup key is changed to "h" from "?", in the latest script.
Try pressing "h" key.
HTH
Regards,
Anand
that was it!
I am a happy camper now!!
Hey Mihai, did they contacted you for taking the leaf out of your book ?
Post a Comment