1.4: Getting Text from User: Loading a Text File – Programming with Text

[ad_1]
In this video, I show you how to get text input from a user by loading a text file using the p5.js function loadStrings(). I discuss how a user can upload their own text file with createFileInput() or a “drag and drop” zone.

Next Video:

Introduction to Programming from A to Z:

Support this channel on Patreon:

Send me your questions and coding challenges!:

Contact:

GitHub Repo with all the info for Programming from A to Z:

Source Code for the all Video Lessons:

loadStrings() reference:

Drag and Drop with p5.js video:

p5.js:
Processing:

For More Programming from A to Z videos:

For More Coding Challenges:

Help us caption & translate this video!


Posted

in

by

Tags:

Comments

17 responses to “1.4: Getting Text from User: Loading a Text File – Programming with Text”

  1. Barnabás Kiglics Avatar

    +The Coding Train
    What should i do if i want to load not ascii characters?

  2. Ram Ram Avatar

    how to do it in nodejs and auto update with out run command bro…….any help

  3. Duy Nguyễn Avatar

    Hi your video is damn great and helful, but when I try to modify the text file like you did in 02:15 and hit reload the local server, the string didn't change at all. How can I fix it, thanks

  4. pu phuc Avatar

    i have a error.
    p5.js:20255 XMLHttpRequest cannot load file:///C:/Users/SNS/Desktop/A2Z/1.4%20Getting%20Text%20from%20User/hh.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
    how can i fix this???

  5. SIMuTech Avatar

    hello Danii, listen how can i do all this in Processing 2.2? sorry i have written allot of p2 to just leave it behind and redo everything in p3 and UP and most lib for p2 dont even exist in most higher versions of processing. so if im going to upgrade anything its going to be after i export my sketch to bring into a real IDE like netbeans or something like VS13 BUT you're still my guy for learning all the time!

  6. Grizzly Hunter Avatar

    Great video. Can you show us how to load text file in JavaScript without using P5 JS framework please? thank you..

  7. Andy Avatar

    I seem to be getting this in my console:
    Uncaught TypeError: fxn.bind is not a function
    at attachListener (p5.js:11756)
    at p5.Element.mousePressed (p5.js:11079)
    at setup (sketch.js:18)
    at p5.<anonymous> (p5.js:9108)
    at p5.<anonymous> (p5.js:9038)
    at new p5 (p5.js:9320)
    at _globalInit (p5.js:5602)

    sketch.js:18 is :
    button.mousePressed(load);

    I've tried with loadfile and many other names for the button and for the " var button = select('#load');" but nothing seems to work.

  8. Taylor King Avatar

    Where do you teach?

  9. Sharan Khan Avatar

    I didn't understand createFileInput for multiple file access what should i pass in 2nd argument should i pass a callbackfunction for that as well? Shouldn't the documentation also include example code as well googling it I didn't find any results.

  10. Jon Martins Avatar

    There's probably something wrong with my code, or could it be my Chrome?
    Developer Tools console won't show anything. Just that ">"thing. Is there anything else I need to do?

  11. Claudio Avatar

    Hello Daniel! First of all thanks to teach to us for free all this stuff! I have a problem I can't figure it out. How can I use the loadTable or loadString function combined with the createFileInput function (or drag and drop technic) to let a user to upload a CSV file? Thanks for any help!

  12. cptstubing Avatar

    When replacing the contents of rainbow.txt to just random words, I must first change the filename from rainbow.txt to something else, and then update the filename in the sketch.js file.
    It is not enough to just CTRL+A and del the contents of rainbow.txt and add some words to it, CTRL+S, and refresh the webpage. It shows the same contents in the right hand console Array […..] unless I rename the file all around and refresh.
    Very strange.

  13. Nsauce Avatar

    Boolean is fun

  14. JTodHalo Avatar

    You do some really great videos! You got me interned in programming and I recently started a computer science course at college and for the second year, I need to do a programming project using advanced algorithms. Any ideas of what I could code?

  15. Mithilesh Shah Avatar

    Hi Daniel, first of all thanks for these lessons.You are awesome..!!!(background sounds plays for awesomeness…haha…;)
    Could you make lessons on interactive data-visualization in p5.js with animations into them.For instance,one on this page http://flowingdata.com/2016/03/03/marrying-age/
    Thanks

  16. SUAVECITO_O Avatar

    This guy is a damn beast at programming

Leave a Reply

Your email address will not be published. Required fields are marked *