Skip to first unread message

gius

unread,
Oct 22, 2015, 12:58:49 PM10/22/15
to MIT App Inventor Forum
Hello everyone,
I want to save the audio file that I'm recording
and save the text of a textbox in .txt,
with the name of the text file with the date and time when saved.
When I try it on the device I have Error 2103
where I'm wrong?

thanks
image.png

Taifun

unread,
Oct 22, 2015, 1:35:01 PM10/22/15
to MIT App Inventor Forum
where do you like to store the file? to sdcard? to the private data directory?
see the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#File

SaveFile(text text, text fileName)
Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard (for example, writing to /myFile.txt will write the file to /sdcard/myFile.txt). If the filename does not start with a slash, it will be written in the program's private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI Companion where these files are written to /sdcard/AppInventor/data to facilitate debugging. Note that this block will overwrite a file if it already exists. If you want to add content to a file use the append block.

also use Do it to debug your filename you created
you probably want to remove the slash before ".txt"... you also can try to remove the spaces in the filename...

Taifun

gius

unread,
Oct 22, 2015, 2:02:05 PM10/22/15
to MIT App Inventor Forum
The Do it I can not activate it. I have problems with the PC.
I removed the "/" and I tried the apk on the device,
the result is the same 
"Error 2103: The  files .... .txt could not be created"

what may be the mistake?

Taifun

unread,
Oct 22, 2015, 2:09:19 PM10/22/15
to MIT App Inventor Forum
without being able to test on the PC; this will be very cumbersome to find bugs
what kind of problems do you have?
see tip 4 here how to use Do it https://puravidaapps.com/learn.php
as already said, you might want to remove the spaces
and what about first trying a simple filename like test.txt?
Taifun

gius

unread,
Oct 23, 2015, 10:39:59 AM10/23/15
to MIT App Inventor Forum
With the "do it" works fine without error, but also on the emulator appears to me "Error 2103"
If I write simply "/Test.txt"
It works fine in device and in the emulator.
What could be the problem?
There can be a conflict between
Call Saudrecord
is
Call File Save?

thanks

Taifun

unread,
Oct 23, 2015, 11:22:28 AM10/23/15
to MIT App Inventor Forum
If I write simply "/Test.txt"
It works fine in device and in the emulator.
What could be the problem?

as already said
1. remove the spaces in the filename
2. and if you want to save to sdcard, you have to prefix the filename with /
3. and use Do it to find out, how your created filename looks like...
Taifun
Reply all
Reply to author
Forward
0 new messages