Lister: use selection as a URL

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Lister: use selection as a URL

Post by *browny »

There is already a nice option to search for a selected text in Google.
A natural addition would be to go directly to the address in selection.
The selection does not need to be parsed for http:// and the like, because quite often URL might be given as www.site.com or even site.org, but a browser still could open that page.
Last edited by browny on 2024-10-12, 11:59 UTC, edited 1 time in total.
User avatar
Gral
Power Member
Power Member
Posts: 1600
Joined: 2005-01-26, 15:12 UTC

Post by *Gral »

Already possible.
Just add similar text to your main INI file under [Lister] section.

Code: Select all

Contextmenu1=Open in default browser|http://%s
You can also define many browsers, e.g.

Code: Select all

ContextMenu2=Open in Opera|"C:\Program Files\Opera\Opera.exe" %s
ContextMenu3=Open in Firefox|"C:\Program Files\Mozilla Firefox\firefox.exe" %s
ContextMenu4=Open in Internet Explorer|"C:\Program Files\Internet Explorer\IEXPLORE.EXE" %s
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Post by *browny »

Code: Select all

Contextmenu2=Open in default browser|%s
This line did precisely what was requested.
Thanks, Gral.
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Re: Lister: use selection as an URL

Post by *browny »

21.08.24 Added: Lister: Right click on URL starting with http://, https://, www. or alphanumeric text with at least one dot before the end selects it and shows context menu item 'Open in default browser' (32/64)
Thanks.
This implementationI could be enhanced, so that the menu item 'Open in default browser' would also be present for a selection: use selection if there is no link at the cursor, or the cursor is at the selection (a link or a part of the link was selected explicitly).
Selected text should not be parsed - this would help if text was not recognized as a URL.
An additional possibility, seletion could be a file path/name to be opened in a browser.

The most common operation with selections is 'Copy', so ''Open in default browser' item should be always at the bottom to prevent the item from jumping around the menu.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Lister: use selection as a URL

Post by *ghisler(Author) »

This implementationI could be enhanced, so that the menu item 'Open in default browser' would also be present for a selection
It already is when you select an URL manually.
Selected text should not be parsed
Why not? You would only get an error otherwise.
this would help if text was not recognized as a URL
Please report any such cases.
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Re: Lister: use selection as a URL

Post by *browny »

ghisler(Author) wrote: 2024-10-13, 07:37 UTC
This implementationI could be enhanced, so that the menu item 'Open in default browser' would also be present for a selection
It already is when you select an URL manually.
It is not if selection was not "a URL" by your definition.
Besides, there are other URL schemes, not only hypertext.
ghisler(Author) wrote: 2024-10-13, 07:37 UTC
Selected text should not be parsed
Why not? You would only get an error otherwise.
No big deal.
For example, a program needs a file name in command line, but got a directory path - simply correct your actions and choose a file.
Same here, user should think at least when selecting text.
ghisler(Author) wrote: 2024-10-13, 07:37 UTC
this would help if text was not recognized as a URL
Please report any such cases.
As said above, file names can be without dots and usually cannot contain URL schemes.
Also examples would be: localhost for local site, of a line "thisserver 10.0.0.10" in hosts file, or DNS suffix in network configuration.

It all boils down to the initial feature request - use selection, otherwise trying to parse text for a link would be a nice addition.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Lister: use selection as a URL

Post by *ghisler(Author) »

You could define your own custom menu item, e.g.
Contextmenu2=Open in Chrome|"chrome.exe" %s
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Re: Lister: use selection as a URL

Post by *browny »

ghisler(Author) wrote: 2024-10-14, 15:22 UTC You could define your own custom menu item
So I did 7 years ago - following Gral's advice; and still keep it for 11.50.
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Re: Lister: use selection as a URL

Post by *browny »

TC does not validate URL syntax or link destination, so user's decisions may take precedence over automatic ones.
Otherwise, the action would still be done with slightly more efforts, be it a custom menu or mere copy & paste.
Post Reply