How do I set the source code of a Safari page to a list?

I am a complete newbie.

I am trying to set the source code of several tiled Safari windows each to a different list. (one window, one list), then I need to combine the lists into one text file.



Why do you want each window’s source as a list if you’re going to combine them as text afterward? Tell us a bit more about what you actually want to accomplish, rather than how you think you should do it. Sounds like you want the HTML of each window appended to a single text file from which you’ll later use a text editor to extract stuff.

Thanks for the reply!

I want to open 9 windows in Safari from The source code for each page contains stock symbols that I want to analyze, and other extraneous data. I want to download the source code of all nine pages, combine the code for all nine of them, then extract out the stock symbols.

Opening all nine pages in Safari is easy enough, but after that I have no idea what to do. Again, I am a complete newbie.

Thanks for your help,


Assuming you know the URLs of those 9 pages, a scripter wouldn’t normally get the source from Safari – the source can be directly loaded into the script (something like this):

set myPage to do shell script "curl [url=$DOWI]$DOWI"[/url]

and would then parse that in the script itself using AppleScript’s text item delimiters. We have some tutorials to get you started in the unScripted section of the bbs, in particular these:

Parsing HTML from a Web Site, which draws on this one: Using AppleScript’s Text Item Delimiters

So you would set up your parser (to extract what you’re looking for) and then in a repeat loop, cycle through the pages from a list of URLs taken one at a time, run your extractor on each, and add that data to whatever list or document you’re preparing to receive the result. If you find that the result is embedded in a line of php or javascript code, you may not be able to extract it.