2016년 11월 16일 수요일

How do I save a Web page with "when Web1.GotText" ...?


Hello ,

I stand on the hose ...
Who can please bring enlightenment to me?
I try a site that I run,
similar to the browser with the right mouse button,
save as "Page Source" in a file.

This should work with web (1) and File (1) using the Web Viewer (1),
but I do not like has to look around the straining.

Who can help me best with a pattern.

Thank you once, hope to speak.


Jörg

use the web component and receive the page source in the Web.GotText event

set web.url to "http://yourWebpage.com"
web.get

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

Taifun

-- 
Thank you very much for your answer.

I have this , it works fine for me, until now...



-- 
you probably haven't seen my edited answer...

if you prefer to store the webpage in a file, then set additionally

set.web.SaveResponse = True

and use the Web.GotFile event instead

see also the documentation of the web component http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web

Taifun

--
Thanks Taifun,

i got it ... one button for opening the web page a other for saving the content



-- 
that's fine, the most important thing, it's working for you

but why don't you set Web.SaveResponse to true and set Web.ResponseFieName to the filename you like and use the Web.GotFile event instead? You do not necessarily need the file component...



GotFile(text url, number responseCode, text responseType, text fileName)
Event indicating that a request has finished.

ResponseFileName
The name of the file where the response should be saved. If SaveResponse is true and ResponseFileName is empty, then a new file name will be generated.

SaveResponse
Whether the response should be saved in a file.


Taifun

-- 

댓글 1개:

  1. How can i save or read HTML cod, which was opened in WebViewer and was receive data? Thanks a lot in advance.

    답글삭제