Upload and generate a text file
Posted
#1
(In Topic #1139)
Enthusiast

I want to do the following:
1. Let the user search the disk like a file explorer. But you can only search for the txt extension.
2. Once found, Gambas should be able to use the.txt file
3. Another option is that instead of searching for it, what I want is for it to create the.txt file and it will create it from a copy that I have in the program path but with a different name. It will then copy the file.xxx and put it in the user's chosen path and rename it from file.xxx to file.txt
More or less explained, what do you suggest I do? Until now what I have done has not worked very well for me, and I always get errors or let's say the user detects errors that I cannot control.
Maybe I don't use the controls properly or I don't know.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.
Posted
Regular

Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

place your template text file in there.
To search for .txt extension files just use Dir with a pattern *.txt
To search for text/plain mimetype files use DesktopMime.class from gb.desktop
Code (gambas)
- Return aTextFiles
Posted
Guru

gambafeliz said
More or less explained, what do you suggest I do? Until now what I have done has not worked very well for me, and I always get errors or let's say the user detects errors that I cannot control.
Maybe I don't use the controls properly or I don't know.
Hehe , more or less lol
post example code of what you are having trouble with dude.
our native tongues are different and explanations can be hard to understand sometimes.
We all speak gambas though
that question would have been much easier to understand exactly what you want to do if you had posted the code too
Posted
Enthusiast

I tell you, but I don't see how to put the code.
I read a configuration file and see if the path of the .txt file is there, if it does not exist, I show a form for the user to search for it among the files or create a new one. When creating it, I only ask them to give it a name and I will do it. I create from one existing among my installation files of my program. I also save in the configuration file that this new or searched is the favorite for the user, so that it loads it by default.
I have done all this but in a rudimentary way or with a personalized form.
My question is more about: is it possible to create it with components already created in gambas?
And if not, someone will send me a similar but optimized form. The thing is that mine is currently chaotic and is not going as well as I would like. To say that I don't put it in because it refers to the configuration and routes file that is of no use to anyone. Besides, I don't want to do it because it is poorly developed.
Finally, I understand that I cannot be helped in this case.
And please I apologize for the bad question. Thank you anyway.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.
Posted
Guru

You'll have to code it yourself.
it shouldn't be too hard.
That's the learning process,
I am sure you will figure out and refine an okay way to do it
Practice makes perfect
Posted
Guru

1. Let the user search the disk like a file explorer. But you can only search for the txt extension.
2. Once found, Gambas should be able to use the.txt file
Try the following code. 1/. It lists all the .txt files is the Home folder and its sub folders. 2/. If you double-click on a file, it will open it in a TextArea.
Am I going in the correct direction?
Code (gambas)
Posted
Enthusiast

I'll look at it to see if it serves as a guide for my file opening.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.
Posted
Guru

1 guest and 0 members have just viewed this.


