Skip to main content
Whatevermajorloser
Inspiring
November 23, 2015
Answered

Open URL in browser via Photoshop

  • November 23, 2015
  • 1 reply
  • 9764 views

Is this possible? I don't need a clickable link for the user or anything, I just need the script to open a URL in the users default browser. How would I go about doing this?

This topic has been closed for replies.
Correct answer xbytor2

function openURL(url) {

  var fname = "shortcut.url";

  var shortcut = new File(Folder.temp + '/' + fname);

  shortcut.open('w');

  shortcut.writeln('[InternetShortcut]');

  shortcut.writeln('URL=' + url);

  shortcut.writeln();

  shortcut.close();

  shortcut.execute();

  shortcut.remove();

};

1 reply

xbytor2Correct answer
Inspiring
November 23, 2015

function openURL(url) {

  var fname = "shortcut.url";

  var shortcut = new File(Folder.temp + '/' + fname);

  shortcut.open('w');

  shortcut.writeln('[InternetShortcut]');

  shortcut.writeln('URL=' + url);

  shortcut.writeln();

  shortcut.close();

  shortcut.execute();

  shortcut.remove();

};

Whatevermajorloser
Inspiring
November 23, 2015

Thanks xbytor2, this works great! I don't quite understand how exactly it works though. When I first ran it, it just opened Safari (which isn't my default browser) but didn't load the page. It was only when removed shortcut.remove() did it actually open the URL.

If you don't mind explaining, I'd love to know what each line of this function does it order for it to work?

Kukurykus
Legend
March 23, 2018

Kukurykus​​, is this xtools really still working (with PS 2018)? Seems great, but hasn't been updated in the past 3 years....


That's the question to xbytor2.

How do you like my new attempt? ie:

system('start http://adobe.com')