title: AppleScript read content from webpage
body: <p>I have been trying to learn AppleScript to solve this problem for a couple of months now. </p>
  
  <p>This is my first question to Stackoverflow, so please let me know if I have posted incorreclty.</p>
  
  <p>I have been doing research on this site and others, seeking to learn what I need to get this AppleScript to do what I want.
  During this learning process I want to accomplish these tasks using AppleScript alone.</p>
  
  <p>In the future I plan to learn Python, JAVA, shell script and more. For now I am concentrating on AppleScript. </p>
  
  <p>My goal is to:</p>
  
  <ul>
  <li><p>Open a webpage.</p></li>
  <li><p>Do a search.</p></li>
  <li><p>Select one of the results.</p></li>
  <li><p>Search on the result page.</p></li>
  <li><p>Copy some text relative to the search string.</p></li>
  <li><p>Paste that into a text document. </p></li>
  <li><p>Copy something else from the result page</p></li>
  <li><p>Paste that into the same text document. </p></li>
  </ul>
  
  <p>.</p>
  
  <pre><code>-- Write Document Text  
  set DocText to ""
  
  -- Look at TextEdit
  tell application "TextEdit"
      activate
      make new document
      -- OPENING REMARKS 
      set DocText to DocText &amp; "Below is the content copied from a web page." &amp; linefeed as string
  end tell
  -- ^ That part works
  
  
  -- Look at Safari   
  tell application "Safari"
      activate
      -- Open URL
      tell application "System Events"
          open location "http://www.ss42.com/toys.html"
          -- Select Search box 
          delay 1
          keystroke tab
          -- Enter search string
          delay 3
          keystroke "cat"
          -- Search
          delay 3
          keystroke return
      end tell
  end tell
  -- ^ Results of search
  -- ^ That section works correctly
  
  
  -- Click Link on results page. ( I don't know how to do this. )
  -- Search for text string in webpage ( I don't know how to do this. )
  -- Copy ContentRelitive to text string search into variable name ( I don't know how to do this. )
  set ContentRelitive to "Content from webpage relative to search string. "
  -- Find AdditionalStuff from page as above
  -- Copy more stuff from webpage into variable name as above
  set AdditionalStuff to "Additional Stuff from web page. "
  -- This ^ is what I NEED to learn!!!
  
  
  -- Paste all content into DocText
  tell application "TextEdit"
      set DocText to DocText &amp; linefeed &amp; "Blank Space " &amp; ContentRelitive &amp; "Blank Space " &amp; AdditionalStuff &amp; "Blank Space " as string
      set the text of the front document to DocText &amp; "Space Filler. " as string
      -- ^ That part works properly
  end tell
  </code></pre>