Put the caret on a source code line containing the URL of a web page:
Then press Alt+T -> U to run this IDE tool Open URL From Current Line:
Here is the source code:
program OpenUrlFromCurrentLine;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Winapi.Windows, Winapi.ShellAPI,
System.Classes,
System.RegularExpressions,
System.SysUtils;
var
ThisLine: Integer;
ThisLineStr, ThisURL: string;
ThisSource: TStringList;
begin // This is explained at: https://en.delphipraxis.net/
try
if ParamCount > 0 then
begin
if ParamCount = 2 then
begin
if FileExists(ParamStr(1)) then
begin
if System.SysUtils.TryStrToInt(ParamStr(2), ThisLine) then
begin
ThisSource := TStringList.Create;
try
ThisSource.LoadFromFile(ParamStr(1));
if ThisSource.Count >= (ThisLine) then
begin
ThisLineStr := ThisSource[ThisLine - 1];
ThisURL := TRegEx.Match(ThisLineStr,
'\b(?:(?:https?|ftp|file)://|www\.|ftp\.)[-A-Z0-9+&@#/%=~_|$?!:,.]*[A-Z0-9+&@#/%=~_|$]',
[roIgnoreCase]).Value;
if ThisURL <> '' then
Winapi.ShellAPI.ShellExecute(0, 'open', PChar(ThisURL), nil, nil, SW_SHOW);
end;
finally
ThisSource.Free;
end;
end;
end;
end;
end;
//Readln;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
Build it.
Then create a new IDE tool and configure it like this:
Now you are ready to have fun. Merry Christmas!