Skip to main content
Inspiring
December 5, 2012
Answered

Link to a web page from AI javascript?

  • December 5, 2012
  • 1 reply
  • 6543 views

I've written a script with a ScriptUI interface, which other people will be using. I'd like to include a 'help' button in the interface, which ideally would connect to a web page with more details. (The alternative is to create the 'help' window in javascript, but the web page already exists and it would be a shame not to use it.)

From what I've read, other Creative Suite programs may be able to connect to the web with javascript, but apparently not Illustrator. Can anyone please confirm this is so? Or better, point me towards a solution!

With thanks.

This topic has been closed for replies.
Correct answer Muppet Mark

Very nice Muppet Mark, good thread.


As it would appear to work mac/pc then I would just wrap it to use like so… I've changed the location to the system temporary junk… Out of sight, and it should get cleaned out at system restart me thinks… I did try f.remove() but that would appear to take place faster than the file can be evoked so I removed it. I doubt very much the size of these would ever be a problem…

openURL( 'www.google.com' );

function openURL( address ) {

          var f = File( Folder.temp + '/aiOpenURL.url' );

          

          f.open( 'w' );

          

          f.write( '[InternetShortcut]' + '\r' + 'URL=http://' + address + '\r' );

          

          f.close();

          

          f.execute();

 

};

1 reply

Inspiring
December 5, 2012

Did you already look at the socket object in the JavaScript Tools Guide…?

Inspiring
December 5, 2012

Yes, it's useful. But sadly, only if you're running Bridge, InDesign, InCopy, After Effects or Photoshop! The object is not available to Illustrator users.

Inspiring
December 10, 2012

As it would appear to work mac/pc then I would just wrap it to use like so… I've changed the location to the system temporary junk… Out of sight, and it should get cleaned out at system restart me thinks… I did try f.remove() but that would appear to take place faster than the file can be evoked so I removed it. I doubt very much the size of these would ever be a problem…

openURL( 'www.google.com' );

function openURL( address ) {

          var f = File( Folder.temp + '/aiOpenURL.url' );

          

          f.open( 'w' );

          

          f.write( '[InternetShortcut]' + '\r' + 'URL=http://' + address + '\r' );

          

          f.close();

          

          f.execute();

 

};


May I just thank all who contributed to this thread and helped answer my question, especially MuppetMark and CarlosCanto. You've created an elegant workaround to a clear deficiency in Illustrator's scripting capability, and I for one am grateful.