Thanks! This works fine. The timeout can even be decreased substantially.morat wrote:@avada
You can use the ctypes to send a right click, then execute the command.
Similar post: http://forums.mozillazine.org/viewtopic ... #p12970451Code: Select all
// Save Link with DownThemAll! Components.utils.import("resource://gre/modules/ctypes.jsm"); var user32 = ctypes.open("user32"); var BOOL = ctypes.int; var LONG = ctypes.long; var POINT = ctypes.StructType("tagPOINT", [{x:LONG}, {y:LONG}]); var LPPOINT = POINT.ptr; var GetCursorPos = user32.declare('GetCursorPos', ctypes.winapi_abi, BOOL, LPPOINT); var point = new POINT; if (GetCursorPos(point.address())) { var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIDOMWindowUtils); var MOUSEEVENTF_RIGHTDOWN = 0x0008; var MOUSEEVENTF_RIGHTUP = 0x0010; utils.sendNativeMouseEvent(point.x, point.y, MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, null); } user32.close(); setTimeout(function () { document.getElementById("dta:regular-link").doCommand(); }, 1000);
keyconfig 20110522
-
- Posts: 1934
- Joined: February 10th, 2008, 6:30 am
- Location: Hungary
Re: keyconfig 20110522
-
- Posts: 2
- Joined: May 11th, 2017, 12:12 am
Re: keyconfig 20110522
Hallo,
thank you for this wonderful extension.
Just one question: What can I do if content is null? I created a simple new shortcut with
The alert window contains just null, so I cannot access the content of the current document.
I am using Firefox 53.0 and Dorando keyconfig 2016.2
Any hints?
Thank you!
thank you for this wonderful extension.
Just one question: What can I do if content is null? I created a simple new shortcut with
Code: Select all
alert(content)
I am using Firefox 53.0 and Dorando keyconfig 2016.2
Any hints?
Thank you!
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@scheffkocha
I guess the content object is null because e10s is enabled. You can disable it.
Electrolysis also called e10s
http://wiki.mozilla.org/Electrolysis#Firefox_Release
I guess the content object is null because e10s is enabled. You can disable it.
Electrolysis also called e10s
http://wiki.mozilla.org/Electrolysis#Firefox_Release
-
- Posts: 2
- Joined: May 11th, 2017, 12:12 am
Re: keyconfig 20110522
@morat
Yes, that's the reason. Thank you for pointing this out!
Yes, that's the reason. Thank you for pointing this out!
-
- Posts: 1086
- Joined: November 8th, 2011, 12:06 pm
Re: keyconfig 20110522
morat are you the person who wrote this addon? can you help me with my request?
- malliz
- Folder@Home
- Posts: 43796
- Joined: December 7th, 2002, 4:34 am
- Location: Australia
Re: keyconfig 20110522
No he's not
nohamelin wrote:@firefoxuse
They are a bunch of code requests, without providing a single clue if you at least took some time to check older pages in this thread to find something similar. The bigger the request, the greater the patience you need to wait for someone who can take that task for you.
What sort of man would put a known criminal in charge of a major branch of government? Apart from, say, the average voter.
"Terry Pratchett"
"Terry Pratchett"
-
- Posts: 8
- Joined: May 20th, 2014, 6:38 am
Command for "Apply filters to messages"
I am looking for a command that does the same as Tools > Apply filters to messages in Thunderbird 52.
More precisely, I am trying to automate "Select All" then "Apply filters to messages" to emulate "Run filters on folder" for virtual folders. However, I have been unable to find the proper command for "Apply filters to messages". I have checked this article and tried every code that seemed to be related to filters and I tried using morat's script from this post by creating a shortcut in keyconfig and pasting the code in the code box, however, nothing gets copied to the clipboard when I press the shortcut (the shortcut works if I set it for different functions, so it is not blocked or anything). Am I using the script wrong?
More precisely, I am trying to automate "Select All" then "Apply filters to messages" to emulate "Run filters on folder" for virtual folders. However, I have been unable to find the proper command for "Apply filters to messages". I have checked this article and tried every code that seemed to be related to filters and I tried using morat's script from this post by creating a shortcut in keyconfig and pasting the code in the code box, however, nothing gets copied to the clipboard when I press the shortcut (the shortcut works if I set it for different functions, so it is not blocked or anything). Am I using the script wrong?
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@hife
Try this:
The code snippet from this post works for me. Perhaps the chrome url is different in Linux.
Thunderbird Commands
http://pastebin.com/raw/nJdfp3ib
Thunderbird 52.1.1
Windows 7 SP1 32-bit
P.S.
You can use the following code to easily extract commands.
The trick does not work for all user interface elements.
Try this:
Code: Select all
// Select All
goDoCommand("cmd_selectAll");
// Run Filters on Message
goDoCommand("cmd_applyFiltersToSelection");
Thunderbird Commands
http://pastebin.com/raw/nJdfp3ib
Thunderbird 52.1.1
Windows 7 SP1 32-bit
P.S.
You can use the following code to easily extract commands.
Code: Select all
function getCommand(event) {
window.removeEventListener("command", getCommand, true);
event.preventDefault();
event.stopPropagation();
alert(event.originalTarget.getAttribute("oncommand") ||
event.originalTarget.getAttribute("onclick"));
}
window.addEventListener("command", getCommand, true);
-
- Posts: 8
- Joined: May 20th, 2014, 6:38 am
Re: keyconfig 20110522
Thanks, that was what I was looking for. However, I just noticed "Apply filters to selection" doesn't seem to work in my smart inbox folder (both when run from the menu or by the above command). That's a separate issue though and not really related to keyconfig, so I'll take that elsewhere.morat wrote:Code: Select all
// Select All goDoCommand("cmd_selectAll"); // Run Filters on Message goDoCommand("cmd_applyFiltersToSelection");
Never mind, it did work once I copied the full code. I missed the scroll-bar, my bad. I'm very sorry about that. (What does not seem to work is the "SELECT ALL" button, which just takes me to the top of the page.)morat wrote:The code snippet from this post works for me. Perhaps the chrome url is different in Linux.
Thanks, would you mind if I linked that in the article?morat wrote:Thunderbird Commands
http://pastebin.com/raw/nJdfp3ib
Thunderbird 52.1.1
Windows 7 SP1 32-bit
That worked like a charm as well. Would you mind if I linked that too?morat wrote:You can use the following code to easily extract commands.
The trick does not work for all user interface elements.Code: Select all
function getCommand(event) { window.removeEventListener("command", getCommand, true); event.preventDefault(); event.stopPropagation(); alert(event.originalTarget.getAttribute("oncommand") || event.originalTarget.getAttribute("onclick")); } window.addEventListener("command", getCommand, true);
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@hife
As an alternative to the cmd_applyFiltersToSelection command, try something like:
http://forums.mozillazine.org/viewtopic ... #p14717611
I don't remember what works with virtual folders.
http://kb.mozillazine.org/Keyconfig_ext ... rnal_links
Another user may have different extensions, thus different commands in his list.
http://forums.mozillazine.org/viewtopic ... #p12492305
It has a version with a confirm dialog to copy the command and a link to the original version.
As an alternative to the cmd_applyFiltersToSelection command, try something like:
http://forums.mozillazine.org/viewtopic ... #p14717611
I don't remember what works with virtual folders.
There is already a link to the code in the external links section.hife wrote:mind if I linked that
http://kb.mozillazine.org/Keyconfig_ext ... rnal_links
Another user may have different extensions, thus different commands in his list.
It's okay, but link the following page in the external links section.hife wrote:mind if I linked that too
http://forums.mozillazine.org/viewtopic ... #p12492305
It has a version with a confirm dialog to copy the command and a link to the original version.
-
- Posts: 1934
- Joined: February 10th, 2008, 6:30 am
- Location: Hungary
Re: keyconfig 20110522
Hi!
Do you think this can be further improved to close the context menu after some time. If DTA window is already open (and I have it set to not come in front) the context menu remains open, even though the download starts.(I also have the context menu item hidden via Menu Wizard because I don't need it there with the hotkey.) (This makes no difference, and I misremembered, they're enabled...)
Do you think this can be further improved to close the context menu after some time. If DTA window is already open (and I have it set to not come in front) the context menu remains open, even though the download starts.
morat wrote:@avada
You can use the ctypes to send a right click, then execute the command.
Similar post: http://forums.mozillazine.org/viewtopic ... #p12970451Code: Select all
// Save Link with DownThemAll! Components.utils.import("resource://gre/modules/ctypes.jsm"); var user32 = ctypes.open("user32"); var BOOL = ctypes.int; var LONG = ctypes.long; var POINT = ctypes.StructType("tagPOINT", [{x:LONG}, {y:LONG}]); var LPPOINT = POINT.ptr; var GetCursorPos = user32.declare('GetCursorPos', ctypes.winapi_abi, BOOL, LPPOINT); var point = new POINT; if (GetCursorPos(point.address())) { var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIDOMWindowUtils); var MOUSEEVENTF_RIGHTDOWN = 0x0008; var MOUSEEVENTF_RIGHTUP = 0x0010; utils.sendNativeMouseEvent(point.x, point.y, MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, null); } user32.close(); setTimeout(function () { document.getElementById("dta:regular-link").doCommand(); }, 1000);
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@avada
The code opens the context popup, runs the command, closes the context popup, then opens a "Add Downloads" dialog. If a "Add Downloads" dialog is already open, then the code opens another "Add Downloads" dialog.
The "Make Your Selection" window does not change anything for me.
I don't understand the problem.
You could try click instead of the doCommand method.
The code opens the context popup, runs the command, closes the context popup, then opens a "Add Downloads" dialog. If a "Add Downloads" dialog is already open, then the code opens another "Add Downloads" dialog.
The "Make Your Selection" window does not change anything for me.
I don't understand the problem.
You could try click instead of the doCommand method.
Code: Select all
- document.getElementById("dta:regular-link").doCommand();
+ document.getElementById("dta:regular-link").click();
-
- Posts: 1934
- Joined: February 10th, 2008, 6:30 am
- Location: Hungary
Re: keyconfig 20110522
@morat
Sorry, I forgot to mention that I use "dta:turbo-link" instead for this, which adds downloads automatically without bringing anything up.
Tried doCommand, but it makes no difference.
Sorry, I forgot to mention that I use "dta:turbo-link" instead for this, which adds downloads automatically without bringing anything up.
Tried doCommand, but it makes no difference.
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@avada
Try this:
Try this:
Code: Select all
// Save Link with dTa! OneClick
Components.utils.import("resource://gre/modules/ctypes.jsm");
var user32 = ctypes.open("user32");
var BOOL = ctypes.int;
var LONG = ctypes.long;
var POINT = ctypes.StructType("tagPOINT", [{x:LONG}, {y:LONG}]);
var LPPOINT = POINT.ptr;
var GetCursorPos = user32.declare('GetCursorPos', ctypes.winapi_abi, BOOL, LPPOINT);
var point = new POINT;
if (GetCursorPos(point.address())) {
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var MOUSEEVENTF_RIGHTDOWN = 0x0008;
var MOUSEEVENTF_RIGHTUP = 0x0010;
utils.sendNativeMouseEvent(point.x, point.y, MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, null);
}
user32.close();
setTimeout(function () {
document.getElementById("dta:turbo-link").doCommand();
document.getElementById("contentAreaContextMenu").hidePopup();
setTimeout(function () {
var win = Services.wm.getMostRecentWindow("alert:alert");
if (win &&
win.document.getElementById("alertTitleLabel") &&
win.document.getElementById("alertTitleLabel").value == "DownThemAll!") {
win.onAlertClose();
}
}, 2000);
}, 1000);
Last edited by morat on May 30th, 2017, 5:41 am, edited 1 time in total.
-
- Posts: 1934
- Joined: February 10th, 2008, 6:30 am
- Location: Hungary
Re: keyconfig 20110522
Thanks!morat wrote:@avada
Try this: