Skip to main content
Participant
March 23, 2016
Question

Place image from web url

  • March 23, 2016
  • 1 reply
  • 1199 views

Hi all,

I'm trying to add a web image to the Artboard via Extendscript.

It seems File doesn't support web urls...

Here's what I've got so far,

var file = File("http://www.placehold.it/200x200‌");

var img = app.activeDocument.placedItems.add();

img.file = file;

img.position = Array(10, -10);

If I drag an image from my web browser (Chrome) to an Illustrator Artboard it magically works, I appears to download

the file to a local (private) folder before placing it. Can I piggy back that process or do I have to write my own?

Is this possible without using Bridge..?

thanks

Greg

This topic has been closed for replies.

1 reply

Silly-V
Legend
March 23, 2016

If not with Bridge, then probably with VBA or AppleScript depending on your platform, to also control the browser.

Or you could go totally insane, like me, and make a script which writes an html page with a script inside which would find a way to get your desired URL and save it to the default downloads folder, and you'd also have that script keep waiting while a desired file is not yet present within that downloads folder, and it would also need to deal with timeouting. But, suppose you had your JSX create your browser page and the scripts inside were successfully ran to yield a new file in the downloads folder, the power would be yours! You could download many images like this and feed them through a filter of interesting actions such as adding metadata to them or adding watermarks or text to them, and finally a categorization routine which can auto-file this new image to a useful location such as your current work folder.

As for the web sockets, I think you can maybe also do them in various other apps other than Bridge, if you have any other ones that are available for use.