PDA

View Full Version : Text file and paragraph


N1Tr0Net
11-23-2006, 05:17 PM
Hello. This is my first post on this forum.
I have 2 questions. Can you explain me how to get text from txt file from internet in paragraph when I click on button in my program. I found some examples on this forum but it's little different. I'm begginer.
Second question is same like first but, I want to get text form file on my disk not form internet.
Sorry for bad english.

yosik
11-24-2006, 02:12 AM
From disk, it is simple. Just use the TextFile.ReadToString action.
As to text from website, more complicated as you have to parse the text from the html file on the remote site (IF it is inside the html and not loaded with a java script or something)..mucho problem.

Yossi

N1Tr0Net
11-24-2006, 05:15 AM
I try to add this code to button:
result = TextFile.ReadToString("AutoPlay\\Docs\\my file.txt");
result = Paragraph.GetText(Paragraph1);

but cant get text in Paragraph1. See the pic in attachment.
I want to make some buttons and when I clik on each button then I want in paragraph1 to see text from txt file.

usernameCasper
11-24-2006, 05:55 AM
Hey N1Tr0Net,

Welcome :)
Use this code:


resultString = TextFile.ReadToString("AutoPlay\\Docs\\my file.txt");
Paragraph.SetText("Paragraph1",resultString);

N1Tr0Net
11-24-2006, 12:06 PM
Thank you yosik, and specially thank's to usernameCasper: That code work.:yes

usernameCasper
11-27-2006, 04:49 AM
np, you´re welcome :)
For the Text from internet, dunno if this possible to grab text from internet in AMS, think its not worthfull, same in my eyes, but if you want, you can copy text from the web and paste it in a Paragraph ? Than make a button, "Save Text !" what saves the text from internet to a *.txt-file ;)
Good luck !

-Casper