Post Reply 
USING .TXT IN AN APP
10-03-2016, 06:02 AM
Post: #1
USING .TXT IN AN APP
Sorry for the inconvenience, Cyrille de Brebisson, but please if you would show an example of how to use an app to open files in .txt format, when I start writing to send but in txt format, what shipping out, messy
Find all posts by this user
Quote this message in a reply
10-04-2016, 05:21 AM
Post: #2
RE: USING .TXT IN AN APP
Hello,

Sorry, but I am not 100% sure that I understand your request...

If what you are trying to do is enter text in an app so that you can exchange that text with the computer, the best solution might be to use Notes, either as independent files using the Notes catalog (shift 0), or as app note (shift apps button).
Then, you can open the file on the connectivity kit and do a copy and paste to a text editor.

If you are using the PC emulator, you can directly use the edit menu copy/paste functions to copy/paste text from the currently opened note to the PC clipboard.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-04-2016, 12:31 PM (This post was last modified: 10-04-2016 12:38 PM by ROBERT.)
Post: #3
RE: USING .TXT IN AN APP
What I mean, that Hp prime, when programmed in the app, there is an option for example to generate images in jpg format.

Then also observe, from one app you can create files in .TXT format
specifically with the command:

AFiles("DATO.txt):="1"

If the .TXT format is generated, but you can not read well, it's like missing something
then why my dudad as use correctly

Also hize with a loop and does not work


Attached File(s) Thumbnail(s)
       
Find all posts by this user
Quote this message in a reply
10-04-2016, 03:21 PM
Post: #4
RE: USING .TXT IN AN APP
I have put on the list a request to allow saving/accessing a .txt file from an app variable as a plain text similar to how jpg/png do something a bit different.

Thanks for the suggestion!

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
10-05-2016, 06:52 AM
Post: #5
RE: USING .TXT IN AN APP
Hello,

Actually, what you are doing when you do:
AFiles("DATO.txt"):="1"
Is that you are storing a string object in a file called DATO.txt...

You can see that by doing
R->B(AFilesB("DATO.txt", 0, 10)) which will return {#FFh,#FFh,#12h,#CDh,#1h,#0h,#0h,#0h,#31h,#0h}
Here, the FFFF means nothing, the 1 is a flag, the 2 means string, CD is a pad, 1, 0, 0, 0 is the size of the string in characters and 31, 0 is the character 1 in 16 bit wchar...

If you saved something else than a string (a number for example), you would see the binary representation of that number.

If you really wanted to create a text file, you would need to do it using the AFilesB (B stands for binary) in order to save your data.
Alternatively, you could do it with a mix of AFiles and ABilesB, doing something like:
AFiles(name):= string; AFilesB(name):= AFilesB(name, 8, 10000);
which will allow you to use the AFiles function to do the string to number conversion, and then use AFilesB to 'shift' the data down and remove the string header (althrough, come to thing about it, you might need to save the data comming from AFilesB(name, 8, 10000) in a temp var, then delete the file and then write it back)...

Cyrille

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
02-06-2018, 05:33 AM
Post: #6
RE: USING .TXT IN AN APP
Lo logrué con AFiles como indican, a modo de práctica personal pude crear un lector, que permite cargar archivos aún si este pasa el límite de longitud de una cadena, puesto que lo procesa por bloques, mi objetivo era usar menos recursos que los .hpnote, lo que aún me falta es optimizarlo porque va algo lento cuando se trata de archivos grandes, aunque no creo que pueda hacerlo más de lo que ya he intentado, no estoy seguro de cuando lo continuaré, esta casi terminado.





En el video lo muestro, pero nuevamente agradezco a Erwin Ried por PrimeMon, ayuda muchísimo.

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
07-06-2023, 08:16 PM
Post: #7
RE: USING .TXT IN AN APP
(02-06-2018 05:33 AM)Carlos295pz Wrote:  Lo logrué con AFiles como indican, a modo de práctica personal pude crear un lector, que permite cargar archivos aún si este pasa el límite de longitud de una cadena, puesto que lo procesa por bloques, mi objetivo era usar menos recursos que los .hpnote, lo que aún me falta es optimizarlo porque va algo lento cuando se trata de archivos grandes, aunque no creo que pueda hacerlo más de lo que ya he intentado, no estoy seguro de cuando lo continuaré, esta casi terminado.





En el video lo muestro, pero nuevamente agradezco a Erwin Ried por PrimeMon, ayuda muchísimo.

Any update for this?
Find all posts by this user
Quote this message in a reply
07-07-2023, 03:18 AM (This post was last modified: 07-07-2023 03:38 PM by HPCarnace.)
Post: #8
RE: USING .TXT IN AN APP
(02-06-2018 05:33 AM)Carlos295pz Wrote:  Lo logrué con AFiles como indican, a modo de práctica personal pude crear un lector, que permite cargar archivos aún si este pasa el límite de longitud de una cadena, puesto que lo procesa por bloques, mi objetivo era usar menos recursos que los .hpnote, lo que aún me falta es optimizarlo porque va algo lento cuando se trata de archivos grandes, aunque no creo que pueda hacerlo más de lo que ya he intentado, no estoy seguro de cuando lo continuaré, esta casi terminado.





En el video lo muestro, pero nuevamente agradezco a Erwin Ried por PrimeMon, ayuda muchísimo.
Interesante programa. Aunque sería bueno que publicaras este y los otros programas en hpcalc o por acá, aunque estén en fase beta.
Yo la verdad apenas llevo con la HP Prime desde el 3 de Mayo y es porque de verdad no tenía mucho interés en este modelo, y también porque desde que se acabó el foro de AdictosHP no volví a tocar mi HP50G (ya cuando justo programaba en SystemRPL).
Eso que te pasó justamente hace tres días lo estaba viendo, ya que estoy mejorando el programa HPPrimeTORA que publiqué hace poco (en HPCalc y por acá). Este es el código que tengo:
EXPORT HPPrimeTORA()
BEGIN
IFERR AFiles("Config.txt")==0 THEN
AFiles("Config.txt") := {1E-9, -0.5, -0.5}; //Err, Xmin, Ymin
END;
// TamArch := AFilesB("Config.txt");
ConfigGeneral := AFiles("Config.txt"); //,TamArch);
subMenuPrincipal();
END;
//Config.txt queda como FE FF 16 00 03 00 00 20 02 00 10 FF FF FF FF FF ...
Yo también pensé (erróneamente) que AFiles lo guardaba como txt y tampoco encontré documentación acerca de la estructura del archivo creado, sin embargo, para mis propósitos actuales servía que era simplemente guardar/recuperar la configuración de mi App en un "Archivo", pero ya estaba pensando en cómo convertir un archivo txt del programa TORA para PC al formato de mi App.
ENGLISH:
Interesting program. Although it would be good if you published this and the other programs in hpcalc or here, even if they are in beta phase.
The truth is that I've barely been using the HP Prime since May 3 and it's because I really didn't have much interest in this model, and also because since the AdictosHP forum ended I haven't touched my HP50G again (when I was just programming in SystemRPL).
I was looking at what happened to you just three days ago, since I am improving the HPPrimeTORA program that I recently published (in HPCalc and here). This is the code I have:
EXPORT HPPrimeTORA()
BEGIN
IFERR AFiles("Config.txt")==0 THEN
AFiles("Config.txt") := {1E-9, -0.5, -0.5}; //Err, Xmin, Ymin
END;
// TamArch := AFilesB("Config.txt");
ConfigGeneral := AFiles("Config.txt"); //,TamArch);
subMenuPrincipal();
END;
//Config.txt queda como FE FF 16 00 03 00 00 20 02 00 10 FF FF FF FF FF ...
I also thought (wrongly) that AFiles saved it as txt and I also couldn't find documentation about the structure of the created file, however, for my current purposes it worked which was simply saving/retrieving my App's configuration in a "File", but I was already thinking about how to convert a txt file from the TORA for PC program to the format of my App.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)