mediaURL
. Be sure to uncheck the Auto delete option, so that it keeps the URL data when we change cards. Also uncheck the Editable option. You should now have something looking like the following screenshot:mouseUp
handler of the Prev button:if the number of this card is > 5 then go previous end if
mouseUp
handler of the Next button. Note that - 1
is used since the last card is the MobGUI card:if the number of this card < the number of cards - 1 then go next end if
mouseUp
handler:showMedia the mgText of group "mediaURL"
keeperbuttons
.refresh
handler:on refresh set the itemdelimiter to "." if char 1 of the last item of the mgText of group "mediaURL" is "m" then show group "Play Media" else hide group "Play Media" showMedia the mgText of group "mediaURL" end if end refresh
Keep Media
.init
function, so that the later lines read like this:if the result > 0 then put the result into tMediaLine put line tMediaLine of gMediaList into gLastMedia showMedia gLastMedia end if
gLastMedia
variable.mouseUp
handler of the Keep Media button to be this:on mouseUp global gLastMedia go card (the number of cards -1) if the mgText of group "mediaURL" is not empty then new card end if set the mgText of group "mediaURL" to gLastMedia save stack "WebScaper" as (specialFolderPath("documents") & "/WebScraper.livecode") send "refresh" to group "keeperButtons" end mouseUp
LaunchScraper
with the following stack script:on openStack set the defaultFolder to specialFolderPath("Documents") if there is not a file "WebScraper.livecode" then put the filename of this stack into masterfile set the itemdelimiter to "/" put "WebScraper.livecode" into the last item of masterfile put specialFolderPath("engine") & "/WebScraper.livecode" into masterfile put specialFolderPath("Documents") & "/WebScraper.livecode" into appfile put URL ("binfile:" & masterfile) into URL ("binfile:" & appfile) end if go stack specialFolderPath("Documents") & "/WebScraper.livecode" answer the filename of this stack end openStack
We added the last feature of our application, a set of cards where we can go to view the bits of media that we've chosen to keep.
If you do make the Web Scraper app and start to find it useful, it's quite likely that there will be a set of web pages that you'd like to go back to again and again. To type the URL every time would be tedious. So, why not make a hidden field on the Browser card and type in a list of your favorite pages. Add a button to the card too, which will bring up a list of those pages for you to choose from. The one you choose can then load the Browser control at the desired page. All of the steps to do this were covered in the The Links card section.
It's pretty certain that if you've carefully followed all the steps in this chapter and indeed all the steps were perfect, you still wouldn't have an app ready to be submitted to the app stores! You would require a splash screen, a main menu, icons on the tab buttons as well and some love from a graphic designer! Feature wise, it would be nice if the images you keep could be zoomed and panned.