title: AppleScript: How to loop through list of URLs one at a time to open & close a browser window
body: <p>I'm trying to load a list of URLs in a browser one at a time. I don't care about any output, I just need the page to load, once finished loading completely, change the location to the next URL in the list. I've tried and given up accomplishing this in Automator. I'd use CURL but I don't know enough about passing authentication (several cookies must be present).</p>
  
  <p>Is this possible with a simple ActionScript? Ideally, input would be a txt file with a line for each URL.</p>
  
  <p><b>Update! This is working:</b></p>
  
  <pre><code>set thePath to (path to desktop as Unicode text) &amp; "sites.txt"
  set theFile to (open for access file thePath)
  set theContent to (read theFile)
  close access theFile
  
  set theURLs to every paragraph of theContent
  
  tell application "Safari"
      repeat with theURL in theURLs
          make new document
          set URL of front document to theURL
          delay 1
          repeat until ((do JavaScript "document.readyState" in front document) is "complete")
              delay 1
          end repeat
          close front document
      end repeat
  end tell
  </code></pre>