Skip navigation
TheNewspaperPlace
Currently Being Moderated

Reading from Website

May 20, 2011 2:59 PM

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!

 
Replies
  • John Hawkinson
    5,512 posts
    Jun 25, 2009
    Currently Being Moderated
    May 21, 2011 1:04 AM   in reply to TheNewspaperPlace

    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? ]

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2011 2:36 AM   in reply to John Hawkinson

    I don't know what happend.

    But prevoiuse script work fine in my Indesign CS3 CS4 and CS5 (OSX10.6.6).

     

    Ten.

     
    |
    Mark as:
  • John Hawkinson
    5,512 posts
    Jun 25, 2009
    Currently Being Moderated
    May 23, 2011 2:40 AM   in reply to Ten A

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2011 2:55 AM   in reply to John Hawkinson

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points