keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
nigelle
Posts: 117
Joined: June 9th, 2005, 8:30 am
Location: France

Re: keyconfig 20080929

Post by nigelle »

Is there a shortcut for Firefox that call "print preview" ?
When I use directly ctrl+P to print I have often ugly results e.g. cut pages....
Kamaji
Posts: 3
Joined: March 20th, 2010, 6:43 pm

Re: keyconfig 20080929

Post by Kamaji »

In Thunderbird, I would like to create a shortcut key for Insert a Link (or convert selected text into Hyperlink) in the composition window, but cannot find the necessary command.

Is it possible to do this at all?
loochyj
Posts: 4
Joined: March 21st, 2010, 6:46 pm

Re: keyconfig 20080929

Post by loochyj »

I would really appreciate some help installing keyconfig in firefox 3.6.3pre. I usually always have success modifying the max version field of the install.rdf file after extracting the contents of the xpi file. After doing that this time, keyconfig installed ok but there is no longer a keyconfig entry in the tools menu. I can install it fine but can find no way to enter the keyconfig menu and change my settings.

I'd really appreciate any help you can provide with this problem, and I'd love to get firefox back to its usual environment. Thanks!
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

mad.engineer wrote:1) For the question related to "Ctrl-K"L
Try

Code: Select all

if(commandDispatcher.focusedWindow.getSelection().toString() == "" &&
 (!commandDispatcher.focusedElement || commandDispatcher.focusedElement.selectionStart == commandDispatcher.focusedElement.selectionEnd))
 goDoCommand("cmd_selectEndLine");

if(
commandDispatcher.focusedWindow.getSelection().toString() == "" &&
 (!commandDispatcher.focusedElement || commandDispatcher.focusedElement.selectionStart == commandDispatcher.focusedElement.selectionEnd))
{
 goDoCommand("cmd_selectLineNext");
 goDoCommand("cmd_selectBeginLine");
}

goDoCommand("cmd_cut"); 
mad.engineer wrote:2) For the question related to toggle between Tc:, Cc:, Bcc: in the Message Write window:
Change the last line to

Code: Select all

} catch(err) { alert(err); }  
to see if any error is reported. Some extensions might modify the structure, so try to disable others temporarily. Or try

Code: Select all

var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);

utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_TAB, 0, 4);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_DOWN, 0, 0);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_TAB, 0, 0); 
instead.

nigelle wrote:Is there a shortcut for Firefox that call "print preview" ?
When I use directly ctrl+P to print I have often ugly results e.g. cut pages....
Try

Code: Select all

PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview); 

Kamaji wrote:In Thunderbird, I would like to create a shortcut key for Insert a Link (or convert selected text into Hyperlink) in the composition window, but cannot find the necessary command.
Try

Code: Select all

goDoCommand('cmd_link')  
but you should already have that assigned to Ctrl+L in the Compose window (listed as "Link" in the keyconfig window).

loochyj wrote:I would really appreciate some help installing keyconfig in firefox 3.6.3pre. I usually always have success modifying the max version field of the install.rdf file after extracting the contents of the xpi file. After doing that this time, keyconfig installed ok but there is no longer a keyconfig entry in the tools menu. I can install it fine but can find no way to enter the keyconfig menu and change my settings.
You might want to disable the compatibility enforcing by adding a boolean 'extensions.checkCompatibility.3.6' through about:config, keyconfig 20080929 seems to work fine for me in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3pre) Gecko/20100324 Namoroka/3.6.3pre.
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20080929

Post by mad.engineer »

Hi dorando,

1) For the question related to "Ctrl-K", I tried your new code and it is exactly what I was looking for. Thank you for the help again.

2) For the question related to "toggle between Tc:, Cc:, Bcc: in the Message Write window:"

I tried adding your suggested code at the end of the original one that you provided earlier:
} catch(err) { alert(err); }

and the error I get when I press the assigned Key via Keyconfig is:

"TypeError: popup is null"

not sure what that mean though.

As for your other code:

var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);

utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_TAB, 0, 4);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_DOWN, 0, 0);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_TAB, 0, 0);

I'm not sure I understood where to add it?. Do I need to replace your original code with the above or replace just " } catch(err) { alert(err); }" with this one or else?. Please clarify.

Thank you.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

mad.engineer wrote:I tried adding your suggested code at the end of the original one that you provided earlier:
} catch(err) { alert(err); }

and the error I get when I press the assigned Key via Keyconfig is:

"TypeError: popup is null"

not sure what that mean though.
Assumable the structure is different on your side, have you tried disabling other extensions temporarily?

mad.engineer wrote:As for your other code[...] I'm not sure I understood where to add it?. Do I need to replace your original code with the above or replace just " } catch(err) { alert(err); }" with this one or else?. Please clarify.
Replace the whole code.
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20080929

Post by mad.engineer »

Hi dorando,

I disabled all the installed extensions and tried your original code with catch(err) { alert(err); } added at the end and received the same error message as earlier:

"TypeError: popup is null".

I also tried your other code with all the extensions disabled and it did not worked either. Though did not see any error message.

Any way, I don't want to take away your time on this one. It is not critical for me as I can live without it by using the mouse just for this one. Thanks for your help again.
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20080929

Post by mad.engineer »

Hi dorando,

I've another request for which I'm hoping to get your help. Please refer to the screen shot: http://img248.imageshack.us/img248/701/screenshotqu.jpg
As you can see that in the Message Compose/Write window, if I want to "Discard/Cancel" a message that I'm composing, I need to click on the "X" icon at the top right-hand side corner of the window, which generates the message: "Do you want to Save the Message ..." as seen in the above screen shot.

I'm trying to figure out how to do the above function via Keyconfig. I tried assigning a key with the following function:

goDoCommand("cmd_close")

But the above did not worked.

I did not see any specific command to "Cancel/Discard" listed at: http://kb.mozillazine.org/Keyconfig_ext ... hunderbird

I would appreciate if you can help me out here. Thanks again.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

mad.engineer wrote:Hi dorando,

I disabled all the installed extensions and tried your original code with catch(err) { alert(err); } added at the end and received the same error message as earlier:

"TypeError: popup is null".

I also tried your other code with all the extensions disabled and it did not worked either. Though did not see any error message.

Any way, I don't want to take away your time on this one. It is not critical for me as I can live without it by using the mouse just for this one. Thanks for your help again.
Strange, at least the second one should have worked. Try

Code: Select all

var node = commandDispatcher.focusedElement;
var text = "";

while(
node.parentNode && !node.id) {
 var current = node.nodeName ;
 if(node.className) current+="."+node.className;
 text = current + "\n" + text;
 node = node.parentNode;
}
 text = node.id +"\n" + text;

alert(text); 
and report the result.
mad.engineer wrote:goDoCommand("cmd_close")
That should be correct, and should by default have Ctrl+W assigned to it (the Alt+F4 provided by Windows should do the same). If you wanted to close the window without being asked try

Code: Select all

close(); 
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20080929

Post by mad.engineer »

Hi dorando,

1) I replaced the old code with the new one as instructed and I get this: http://img13.imageshack.us/img13/1768/screenshotig.jpg now.

One thing that I'd like to mention here is that, by default the focus or the cursor in the Message Write Window is in the address box field. So, before I can do any function via keyboard key including selecting To:, Cc: Bcc: from the pull-down menu, I have to use the Shift+Tab key to change the window focus/cursor out of the address box. Which is what I did. I first did a Shift+Tab to move the window focus out of the address box and on to the To:, Cc:, BCc: pull-down menu and when I pressed the assigned key, I received the message "addressCol1#2" as seen in the screen shot. Again, I really appreciate your help but as mentioned earlier, even if this does not work, it is OK, I can use the mouse just for this function as a workaround.

2) As for the goDoCommand("cmd_close"), I added a .focus(); at the end so that the focus shifts to the window and then close it. Works fine now.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

mad.engineer wrote:One thing that I'd like to mention here is that, by default the focus or the cursor in the Message Write Window is in the address box field. So, before I can do any function via keyboard key including selecting To:, Cc: Bcc: from the pull-down menu, I have to use the Shift+Tab key to change the window focus/cursor out of the address box. Which is what I did. I first did a Shift+Tab to move the window focus out of the address box and on to the To:, Cc:, BCc: pull-down menu and when I pressed the assigned key, I received the message "addressCol1#2" as seen in the screen shot. Again, I really appreciate your help but as mentioned earlier, even if this does not work, it is OK, I can use the mouse just for this function as a workaround.
Use the original code without Shift+Tabbing to the dropdown (leave the focus in the text field on the right).
nigelle
Posts: 117
Joined: June 9th, 2005, 8:30 am
Location: France

Re: keyconfig 20080929

Post by nigelle »

" PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview); "
Does not do the job I wish at least on this page : I wished to have exactly the same thing as if I have clicked on "File" then on "print preview" which opens a new firefox screen with header allowing to choose the scale and to print or close. Your shortcut just change the present tab to show the text (the content of the pages) but without the header : it is not usable...
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20080929

Post by mad.engineer »

Hi dorando,

> "Use the original code without Shift+Tabbing to the dropdown (leave the focus in the text field on the right)."

==> I used your original code again and assigned "Ctrl+Shift+Z" to this code in keyconfig:

try {
/addressCol2#([0-9]*)/.test(commandDispatcher.focusedElement.parentNode.parentNode.parentNode.id)
var popup = awGetPopupElement(RegExp.$1);
switch(popup.selectedIndex) {
case awGetSelectItemIndex("addr_to"):
popup.selectedIndex = awGetSelectItemIndex("addr_cc");
break;
case awGetSelectItemIndex("addr_cc"):
popup.selectedIndex = awGetSelectItemIndex("addr_bcc");
break;
default:
popup.selectedIndex = awGetSelectItemIndex("addr_to");
}
} catch(err) { alert(err); }

As suggested, I did not moved the window focus using Shift+Tab. Now, when I press "Ctrl+Shift+Z" in the address box, nothing happens. No error message received either.
The reason I used this 3 key combination was because, earlier I used just one key for example "A" for this function and every time I pressed "A", it tried to use my LDAP directory to do a name look up instead (since the focus is in the address box). So, this time I used a 3 key combination to eliminate this. Thanks
loochyj
Posts: 4
Joined: March 21st, 2010, 6:46 pm

Re: keyconfig 20080929

Post by loochyj »

What file do I add this code to?

dorando wrote:
mad.engineer wrote:1) For the question related to "Ctrl-K"L
Try[code=php]if(commandDispatcher.focusedWindow.getSelection().toString() == "" &&
 (!commandDispatcher.focusedElement || commandDispatcher.focusedElement.selectionStart == commandDispatcher.focusedElement.selectionEnd))
 goDoCommand("cmd_selectEndLine");

if(commandDispatcher.focusedWindow.getSelection().toString() == "" &&
 (!commandDispatcher.focusedElement || commandDispatcher.focusedElement.selectionStart == commandDispatcher.focusedElement.selectionEnd))
{
 goDoCommand("cmd_selectLineNext");
 goDoCommand("cmd_selectBeginLine");
}
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

nigelle wrote:" PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview); "
Does not do the job I wish at least on this page : I wished to have exactly the same thing as if I have clicked on "File" then on "print preview" which opens a new firefox screen with header allowing to choose the scale and to print or close. Your shortcut just change the present tab to show the text (the content of the pages) but without the header : it is not usable...
That code works for me, maybe another extension redirecting it to a tab for you. Try

Code: Select all

function getCommand(event) {
 window.removeEventListener("command", arguments.callee, true);
 event.preventDefault();
 event.stopPropagation();

 alert(event.target.getAttribute("oncommand") || event.target.getAttribute("onclick"));
}

window.addEventListener("command", getCommand, true); 
and click on File > Print Preview to see what code the menuitem uses on your side.

mad.engineer wrote:As suggested, I did not moved the window focus using Shift+Tab. Now, when I press "Ctrl+Shift+Z" in the address box, nothing happens. No error message received either.
Out of ideas currently, but try the other code too:

Code: Select all

var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);

utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_TAB, 0, 4);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_DOWN, 0, 0);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_TAB, 0, 0); 
. Simply simulating the key presses should work.

loochyj wrote:What file do I add this code to?
Use the code with Add a new key (button on the lower left) in keyconfig.
Last edited by dorando on March 29th, 2010, 10:57 am, edited 1 time in total.
Post Reply