Read a .txt file

Explorer ,
Oct 26, 2011 Oct 26, 2011

Copy link to clipboard

Copied

I'm trying to find out how to read a .txt file and simply assign its contents to a variable. Is this possible?

 

[Edit] Right after posting I found this page which seems like it might be in the direction I want to go but I haven't checked it out completely yet: Read Tab Delimited Text File

Just posting the link for future searchers or if anyone will tell me 'Hey! That's not what you're looking for!'

TOPICS
Actions and scripting

Views

700

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Oct 26, 2011 Oct 26, 2011

For anyone interested, the simplified answer for me was:

var fileToParse = File ('path');

fileToParse.open('r');

var dataToGet = fileToParse.readln();

fileToParse.close();

I only needed the one line, so thats why my example above is so simple.

Likes

Translate

Translate
Explorer ,
Oct 26, 2011 Oct 26, 2011

Copy link to clipboard

Copied

For anyone interested, the simplified answer for me was:

var fileToParse = File ('path');

fileToParse.open('r');

var dataToGet = fileToParse.readln();

fileToParse.close();

I only needed the one line, so thats why my example above is so simple.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 22, 2022 Jul 22, 2022

Copy link to clipboard

Copied

LATEST

What should you do if you need more than one line?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines