Skip to main content
Roy Marshall
Known Participant
May 13, 2015
Question

Placing an image on my page using a URL

  • May 13, 2015
  • 1 reply
  • 2328 views

Hi.

I have no idea if this is possible, but would love to hear if anyone can point me in the right direction.

Using an InDesign Javascript I can piece together a URL, that when pasted directly into a browser displays an image that I need to place into InDesign.

Here is the URL

http://XXXXXXXXXXX.co.nz/login/SearchService?SERVICE_REQUEST_TYPE=4&SERVICE_REQUEST_USERID=1650&SERVICE_REQUEST_ASSETID=84035&SERVICE_REQUEST_PASSKEY=xxxxxxxx

You will have to believe me that putting in the proper data instead of the xxxx does show an image in my browser

Is there a way I can grab the image, and place into InDesign using Javascript?

I know I may have to download to a temporary location first which is fine.

Maybe some way to encode to base64....

I would like to keep this platform independent, but if I need to resort to injecting a bit of applescript, I can live with it.


Hopefully this is enough for now to get some suggestions!


Thanks in advance,


Roy

This topic has been closed for replies.

1 reply

Vamitul
Brainiac
May 13, 2015

you can get the image using the Socket object. In the Javascript Tools Guide Pdf, ~page 190 you will find a working example that gets a html file, but it can easily be adapted to get a image.

then here is also Rorohiko: July 2008

Roy Marshall
Known Participant
May 13, 2015

Hi

Thanks for the reply.

I do use sockets for other web page content that I need to access, but thats only to access text/data in the reply back from the connection read.

What I am trying to do here is return back an image from this page (that is all the physical page contains) and use it in InDesign.

I have tried different variations of the call, but the reply is always nothing. Even if it was to return something, all it would be would be a link to the image online wouldn't it? How would I use that?

Anyway, here is the line of code I am using in full so you can see what I mean.

http://redworksnz.co.nz/login/SearchService?SERVICE_REQUEST_TYPE=4&SERVICE_REQUEST_USERID=1650&SERVICE_REQUEST_ASSETID=84035&SERVICE_REQUEST_PASSKEY=password

There is nothing here that is really sensitive.

I would appreciate any further comments.

Thanks again

Roy

Roy Marshall
Known Participant
May 13, 2015

var s=new Socket();

s.open('redworksnz.co.nz:80');

s.write ('GET login/SearchService?SERVICE_REQUEST_TYPE=4&SERVICE_REQUEST_USERID=1650&SERVICE_REQUEST_ASSETID=84035&SERVICE_REQUEST_PASSKEY=password');

var r= s.read();

$.write(r);

You get a CDATA block as a reply that should contain the image.


Hey.

Thanks for that.

After a quick test, I get

<![CDATA[]]>Result: undefined

doesnt look right...

I did get Chris (Rorohiko) script to work, but just need analyse further.