Australia
Asked

Reading Content From Text File Located On Web Page

In a script within Synthiam ARC, how can I read the content from a text file that is hosted on a web page? For example, the file is located at the following URL: https://rur.free.nf/Dialogue%20Script.txt.

Could you provide guidance on how to achieve this?



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

ARC Pro

Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.

Author Avatar
PRO
Canada
#1  

To read the content from a text file hosted on a web page using a script within Synthiam ARC, you can utilize the Net.hTTPGet() function. This function sends an HTTP GET request to the specified URL and retrieves the content as a string. Here's how you can achieve this:

  1. Open ARC: Make sure you have ARC open and your project loaded.

  2. Add a Script Control: If you haven't already, add a script control to your project where you can write your JavaScript or Python code.

  3. Write the Script: Use the following script to read the content from the specified URL:

    // Define the URL of the text file
    var url = "https://rur.free.nf/Dialogue%20Script.txt";;
    
    // Use the Net.hTTPGet() function to retrieve the content
    var content = Net.hTTPGet(url);
    
    // Print the content to the console
    print(content);
    
  4. Run the Script: Execute the script to see the content of the text file printed in the console output of ARC.

This script will fetch the content of the text file from the specified URL and display it in the console. You can further process the content as needed for your robot's functionality.

If you have any more questions or need further assistance, feel free to ask!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.