Page 1 of 1

Fastest way to paste a URL from clipboard as a URL file?

Posted: 12 Sep 2024 14:05
by autocart
Hi all,

What is the fastest way to paste a URL from clipboard as an URL file?

I want the same result as if I navigated to that URL in a browser and then dragged the URL from the browser's address bar (from its padlock icon) into XY.
But I don't want to have to open the URL in the browser first.
Is there a working solution for that in XY already available?

regards, me.

Re: Fastest way to paste a URL from clipboard as a URL file?

Posted: 12 Sep 2024 14:48
by highend
The usual scripting?

Code: Select all

    $content = readurlutf8(<clp>);
    if ($content) {
        $head  = regexmatches($content, "<[ ]*?head[ ]*?>(\s|\S)*?<[ ]*?/head[ ]*?>");
        $title = regexmatches($head, "<[ ]*?title[ ]*?>.*?<[ ]*?/title[ ]*?>");
        $title = trim(regexreplace($title, "<[ ]*?/?title[ ]*?>"));
        if ($title == "") { $title = "Current URL"; }
        writefile($title . ".url", "[InternetShortcut]<crlf>URL=<clp>", , "utf8");
    }

Re: Fastest way to paste a URL from clipboard as a URL file?

Posted: 12 Sep 2024 16:00
by autocart
Ok, that i a helpful start, thank you very much!