Copy link to clipboard
Copied
Hello Everyone!
Is it possible to grab the contents of a webpage and store the value into a variable? We have a script that generates one line of text for a correlating inDesign file on our webserver. Rather than having to our website and copy/paste the line into their inDesign file, it would be wonderful to automate this task by being able to have a script fetch this line. Is there any documentation explaining a method to grab the contents of a file (in my case a webpage) or does anyone know how to accomplish something like this?
Thanks in advance!
Copy link to clipboard
Copied
Yes. See Chapter 6 of the Javascript Tools Guide, which has this example:
reply = "";
conn = new Socket;
// access Adobe’s home page
if (conn.open ("www.adobe.com:80")) {
// send a HTTP GET request
conn.write ("GET /index.html HTTP/1.0\n\n");
// and read the server’s reply
reply = conn.read(999999);
conn.close();
}
[ In CS3 there was an Http object, but you couldn't use it from InDesign anyhow, only Bridge. Anyone know what happened to that? ]
Copy link to clipboard
Copied
I don't know what happend.
But prevoiuse script work fine in my Indesign CS3 CS4 and CS5 (OSX10.6.6).
Ten.
Copy link to clipboard
Copied
Sorry, are you the same person as the original poster?
Are you saying it doesn't work in CS5.5, or just that you don't know where the Http object went?
The Http object was never present for InDesign, to the best of my knowledge.
Copy link to clipboard
Copied
I'm not orign poster.
Sorry to my self-deceived. As you say, "Http Object" nolonger in Indesign. So we use connecting network, use Socket Object from CS3.
Ten.