| View previous topic :: View next topic |
| Author |
Message |
ganeshmb Guest
|
Posted: Fri Jun 27, 2008 4:22 pm Post subject: clicking selected link |
|
|
| I want to add a hot key to click selected link in the browser. How can I do this? |
|
| Back to top |
|
 |
argneo
Joined: 14 Sep 2007 Posts: 136
|
Posted: Fri Jun 27, 2008 7:12 pm Post subject: |
|
|
IE or FF? _________________ WoW |
|
| Back to top |
|
 |
Razlin
Joined: 05 Nov 2007 Posts: 434 Location: canada
|
Posted: Fri Jun 27, 2008 7:18 pm Post subject: |
|
|
Do you have to click it or can you just not hit the enter key? _________________ -=Raz=- |
|
| Back to top |
|
 |
ganeshmb Guest
|
Posted: Fri Jun 27, 2008 8:52 pm Post subject: |
|
|
I need this for Firefox.
When I search text in firefox, it highlights the match, which is a link. And, I want the ability to fire a shortcut key at this point to open the highlighted link.
If I press "Enter", it's just taking me to the next match. |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 139
|
Posted: Sat Jun 28, 2008 1:38 pm Post subject: |
|
|
| ganeshmb wrote: | When I search text in firefox, it highlights the match, which is a link. And, I want the ability to fire a shortcut key at this point to open the highlighted link.
If I press "Enter", it's just taking me to the next match. |
I have no problem searching then pressing enter to open the highlighted link in Firefox at all. Are you using the FAYT Add-on? _________________ Have trouble searching the site for information? Try Quick Search for Autohotkey. |
|
| Back to top |
|
 |
ganeshmb Guest
|
Posted: Sun Jun 29, 2008 6:00 am Post subject: no luck |
|
|
Thanks for your reply!
But, no luck with Firefox and FAYT addon. I am seeing the same behavior - pressing "Enter" always takes me to the next match.
I am wondering if there is a way to do this using Autohotkey scripting. I should be able to click on the text that has been selected. That way, I can use this solution for all applications,not just Firefox. Any idea? |
|
| Back to top |
|
 |
einsmite
Joined: 30 Mar 2008 Posts: 16
|
Posted: Sun Jun 29, 2008 5:13 pm Post subject: |
|
|
| ganeshmb wrote: | I need this for Firefox.
When I search text in firefox, it highlights the match, which is a link. And, I want the ability to fire a shortcut key at this point to open the highlighted link.
If I press "Enter", it's just taking me to the next match. |
Send the Escape key to exit Firefox's search mode, then send Enter.
| Code: |
Send, ^f ; Tell Firefox to search
Send, Some text that matches a link
Send, {Esc} ; Exit Firefox search mode, the link should be highlighted
Send, {Enter} ; Follow the link |
|
|
| Back to top |
|
 |
ganeshmb Guest
|
Posted: Mon Jun 30, 2008 5:22 am Post subject: |
|
|
That works! Thanks einsmite.
That should take care of me 90% of the times since I mostly use Firefox for my browsing. But like I said before, I am still interested in Autohotkey solution for the ability to click on the selected text. This would help me with other applications as well. |
|
| Back to top |
|
 |
Razlin
Joined: 05 Nov 2007 Posts: 434 Location: canada
|
Posted: Mon Jun 30, 2008 1:55 pm Post subject: |
|
|
may solve your issues. _________________ -=Raz=- |
|
| Back to top |
|
 |
Hasso
Joined: 23 Mar 2005 Posts: 158 Location: Germany
|
Posted: Tue Jul 01, 2008 7:23 am Post subject: |
|
|
ganeshmb,
this can easily be done with javascript. The following code searches all links of the current page, if the link text equals to the highlighted search result, the appropriate page will be displayed.
| Code: | SetTitleMatchMode, 2
#IfWinActive, Mozilla
#x:: ;change the hotkey to your desired one
clipboard=javascript:for(var i = 1; i <= document.links.length; i++){if(document.links[i].text.indexOf(window.getSelection()) != -1){location.href=document.links[i].href;break}}
send !s^a^v{ENTER}#IfWinActive |
Tested.
This way it only works in Mozilla based browsers (as Firefox or Netscape). For IE use | Code: | SetTitleMatchMode, 2
#IfWinActive, Internet Explorer
#x:: ;change the hotkey to your desired one
clipboard=javascript:for(var i = 1; i <= document.links.length; i++){if(document.links[i].text.indexOf(document.selection.createRange().text) != -1){location.href=document.links[i].href;break}}
send !s^a^v{ENTER}
#IfWinActive | instead. _________________ Hasso
Programmers don't die, they GOSUB without RETURN |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Tue Jul 01, 2008 8:16 am Post subject: |
|
|
@ Hasso-
All that does for me is go back...
Alt+s opens History, Ctrl+a and Ctrl+v do nothing since the history menu is open, and then the {Enter} activates the Back option, since that is the first option and therefor selected when the menu is opened... |
|
| Back to top |
|
 |
Hasso
Joined: 23 Mar 2005 Posts: 158 Location: Germany
|
Posted: Tue Jul 01, 2008 9:18 am Post subject: |
|
|
In my Firefox (and IE as well) Alt+s activates the address field (I have German versions). So you'll have to find out the matching key for your version and replace Alt+s with that one. _________________ Hasso
Programmers don't die, they GOSUB without RETURN |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Tue Jul 01, 2008 9:23 am Post subject: |
|
|
Ah. That would be Alt+d for me.
Works like a charm now! Amazing stuff (:
Edit: Actually. It takes the first link on the page, as far as I can tell. It seems to be de-selecting the link when it sets focus on the address bar, so the window.getSelection() is taking the first link I guess? |
|
| Back to top |
|
 |
Hasso
Joined: 23 Mar 2005 Posts: 158 Location: Germany
|
Posted: Tue Jul 01, 2008 10:22 am Post subject: |
|
|
| Quote: | | Actually. It takes the first link on the page, as far as I can tell. It seems to be de-selecting the link when it sets focus on the address bar, so the window.getSelection() is taking the first link I guess? |
No, it takes the first link matching (even partly) your search expression. If there is more than one link matching you'll have a problem with my initial script.
I have refined that with a confirm box asking you if it's the desired link. The Box displays the complete text of the link.
If you click OK it will show the link, if you click Abort it shows the next matching link (if existing). | Code: | SetTitleMatchMode, 2
#IfWinActive, Mozilla
#x:: ;change the hotkey to your desired one
clipboard=javascript:for(var i = 1; i <= document.links.length; i++){if(document.links[i].text.indexOf(window.getSelection()) != -1){Check = confirm(document.links[i].text+"\n\nIs this the right link, then click OK, otherwise go to the next one with Abort.");if (Check == true){location.href=document.links[i].href;break}}}
send !s^a^v{ENTER}#IfWinActive |
Tested. _________________ Hasso
Programmers don't die, they GOSUB without RETURN |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Tue Jul 01, 2008 10:25 am Post subject: |
|
|
Oh!
Sorry, I was just highlighting the link by tabbing, not using the search function.
Now it works perfectly  |
|
| Back to top |
|
 |
|