Page 1 of 1
New url shortcut
Posted: 02 Oct 2012 06:15
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.
Re: New url shortcut
Posted: 02 Oct 2012 07:29
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...
Re: New url shortcut
Posted: 02 Oct 2012 08:40
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.
Re: New url shortcut
Posted: 02 Oct 2012 08:53
by kiwichick
Oh of course! Thanks Marco, I think I can work with that

Re: New url shortcut
Posted: 02 Oct 2012 09:22
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";
Re: New url shortcut
Posted: 02 Oct 2012 09:37
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);