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 7, 2012

good one Mark,


To be honest it looked obvious to pretty me…? Does this work on the PC? I have not looked if different browsers require differing strings but it worked first time for me… Not surprised at the uneven playing field pointed out by David it's so offen the case… Just presumed socket was available to all apps… When you script a couple like I try to do there can be a little fuzzieness from time to time… As of CS3 the mac should be able to write and execute shell although I have not had need to this yet… Unfortunately AI appears to languish behind the rest on several fronts… but we try our best…