Edit text file with MIT App inventor 2?

589 views
Skip to first unread message

Alex Le Tux

unread,
Apr 26, 2016, 2:16:00 AM4/26/16
to MIT App Inventor Forum
Hi,

I'm noob with MIT App inventor 2, i need to download and edit a text file, so i found how to download a file but now i need to edit this file, remove some text and add some text (many and many text it's a big file).

So you can help me to do this ?

thx
Sorry for my poor english.

Hossein Amerkashi

unread,
Apr 26, 2016, 7:45:18 AM4/26/16
to MIT App Inventor Forum
@Alex,

Simplest way would be to completely overwrite the file with new content. 
Also, consider using other storage components such as TinyDB.



Hossein Amerkashi http://Amerkashi.Wordpress.com   | http://AppyBuilder.com 

 

   

    

Alex Le Tux

unread,
Apr 27, 2016, 3:11:05 PM4/27/16
to MIT App Inventor Forum
I tried to do something with TinyDB but i don't find how i can do this.


i already created my app for windows, i use Autohotkey to make my app, i use function "String replace" to replace some texts and now i want to create a android version of my app.
So i think i need to use something like "String replace" to replace some texts in my file, we can find something like this in MIT App inventor ?

My windows app works like this :
-> Download the file from internet
-> Save the file in my HDD (named file1.txt)
-> Read file1.txt 
-> Replace some texts
-> Save the new file with the new texts in my HDD (named file2.txt)

So i need to do same thing with MIT App inventor.

You can help me please ?

Taifun

unread,
Apr 27, 2016, 3:48:16 PM4/27/16
to MIT App Inventor Forum
use the file component to read the file and the text blocks to manipulate the text


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

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by  Taifun.         



Italo

unread,
Apr 27, 2016, 4:21:59 PM4/27/16
to MIT App Inventor Forum


Reply all
Reply to author
Forward
0 new messages