New url shortcut

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kiwichick
Posts: 678
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

New url shortcut

Post by kiwichick »

Hi there, I would like to be able to copy a url address to the clipboard, then run a script that will create a 'New shortcut' ready for rename. It won't be a straightforward new() command though, will it, because I'm not just creating a new file with a url extension? I don't know how to incorporate the url address. Or is it some other command I need to look at? Cheers.
Windows 10 Pro 22H2

highend
Posts: 14956
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: New url shortcut

Post by highend »

There is no scripting command that can create the link in the url file. If you can't find an external cli tool, that does it...
One of my scripts helped you out? Please donate via Paypal

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: New url shortcut

Post by Marco »

However the file format is really simple, since it contains a text like

[InternetShortcut]
URL=http://...

With a couple of lines of code it should be easy to accomplish what the OP wants.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

kiwichick
Posts: 678
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: New url shortcut

Post by kiwichick »

Oh of course! Thanks Marco, I think I can work with that :)
Windows 10 Pro 22H2

highend
Posts: 14956
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: New url shortcut

Post by highend »

Never looked into such a file, thanks for pointing that out, Marco!

So you just need one (new) command (you've got the rest in one of your other scripts already):
setkey "<clipboard>", "URL", "InternetShortcut", "<curpath>"."\"."new shortcut.url";
One of my scripts helped you out? Please donate via Paypal

kiwichick
Posts: 678
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: New url shortcut

Post by kiwichick »

Hi guys, I didn't even think about opening an existing url in a text editor to see it contained merely the:

[InternetShortcut]
URL=http://...

So obvious really. So between that and a suggestion I got from someone else, the writefile command is a pretty easy way of going about it. This is basically it:

Code: Select all

$a = "[InternetShortcut]<crlf>URL=<clipboard>";
      writefile("New Shortcut.url", "$a", r);
Windows 10 Pro 22H2

Post Reply