How to add a text as .txt file?


Totally new here. I just want to change the text in this generative design text:

How can I change this “faust_kurz.txt” for my own text and include it as a .txt file?? …Just have no clue…

function preload() {
  joinedText = loadStrings('data/faust_kurz.txt');

Thank you in advance!

1 Like

when the file is on your hard drive (make a copy), load it in text editor like Notepad and edit it there and save it with the same name

When the file is not there, make a folder data and therein a text file with the name and put some content in it.

This will also work:

joinedText = {
1 Like

Thanks a lot for your response! I just want to change the text from that example in the link…

I have no clue of python, and I don’t know where to make a folder data and how to include that inside those code lines in the link.

Also I tried to add the “joinedText” lines, but I don’t know where or how to do it.

I am totally clumsy… Any way to simply change the text in a simple and straight way?

Thank youuuuu

He’s loading a simple text file in that line. The text in the link is a relative path to a file.

The content of this text file is used.

You can either change the name of the file OR change its content

When you hit ctrl-k you get to your Sketch folder on your hard
Drive. There you can make (in your windows OS) the folder data and make a text file in it manually.

Thank you so much for the quick response…

But I am in Mac and this ctrl-k shortcut doesn’t work.
Do you mean that I can have a .txt file in my Mac, and substitute the data/faust_kurz.txt for the path of my file?

In that case, what format should that path have? I just tried several forms like “/Users/david/Desktop/text.txt”, my file is in my desktop, but the p5.js editor says:

Error: [object ReadableStream]
    at [47]</i.prototype.httpDo/f< (

I just want to change the .txt from this p5.js Web Editor

But I really cannot manage, what format should my path to the file have? Is there other way?

I really need to solve this, thank you so much in advance

Ah okay, sorry, p5.js here

So you are in your browser

So you don’t have a file and the Sketch terminates there ?

I think you can add files on the side menu on the right

Wow… I am really trying everything to upload a .txt file … or … I just don’t know how to do it and what to do or how to proceed

How do I change a text or a pic from this string?

function preload() {
  img = loadImage('data/pic.png');

Hello @Davo ,

Assuming you are working in the p5.js editor:

Steps I followed:

  • Login in. If you do not have an account then create one and log in.

  • Open this sketch:

  • Expand the File menu (down arrow) and select duplicate
    You now have a copy to work with!
    Work with that from this point on…

  • Expand the menu next to sketch name (arrow pointing to right):

    After expanding:

  • Make sure you are always working with your copy from this point on.

  • Hover your mouse over the data folder and another arrow appears pointing down!
    Expand that and you will see:

  • I was not able to edit fast_kurtx.txt
    I was able to Create file called text.txt and edit that.
    I could rename fast_kurtx.txt but was not able to edit so created new file.

  • You can also Upload file, Rename, etc.

That should get you started.

It is a challenge at first to navigate those menus!

There may be a good tutorial or video out there… see what a Google search comes up with and share.


That is sooooo nice

THANK YOU for taking the time and the calm to explain it to me.
I will try it during the day and hopefully make it work.

Have a nice day


it’s so easy once I followed your step by step expanation.

You really made my day, please feel during this day that somewhere near Dresden (Germany) someone will have a great day because of you

Thank you again