Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Overview of this book

Table of Contents (15 chapters)
LiveCode Mobile Development Beginner's Guide Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – setting up the Text card


We will start off in the test stack that you made, so that we can get the function working there before adding it to the WebScraper stack.

  1. Duplicate the button you made when extracting links. Change the function call getLinks to getText; the rest of the script can remain the same.

  2. Edit the script of the test stack and add this function:

    function getText pPageSource
      put replaceText(pPageSource,"(?:<(?P<tag>script|style)[\s\S]*?</(?P=tag)>)|(?:<!--[\s\S]*?-->)|(?:<[\s\S]*?>)","") into pPageSource
      replace lf with "" in pPageSource
      replace tab with " " in pPageSource
      return pPageSource
    end getText
  3. Try clicking on the button you just made. You should see your second field filled with just the text parts of the web page.

  4. Copy the function and go back to the WebScraper stack script. Paste the function there.

  5. Go to the Text card of the stack and from the MobGUI window, drag the Multiline Text control onto the card. Set its name...