Time for action – setting up the Text card
Start off in the test stack you made, so we can get the function working there before adding it to the WebScraper stack.
Duplicate the button you made when extracting links. Change the function call
getLinks
to saygetText
- otherwise the script can remain the same.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
Try clicking on the button you just made. You should see your second field fill with just the text parts of the web page.
Copy the function, and go back to the WebScraper stack script. Paste the function there.
Go to the Text card of the stack, and from the MobGUI window drag a Multiline Text control onto the card. Set its name to
PageText...