EZ-B Settings icon EZ-B Settings Configures and pushes WiFi SSID, password, system name and channel to EZ-Robot EZ-B v4 from ARC; saves settings with project for quick redeploy. Try it →
Australia
Asked

Syntax For Referencing File Location In Ezscript

What is the Syntax for referencing a file location (directory) in EZScript? For example "C:\Images" + $Variable + ".jpg" return an error message.



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

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#9  

I apologize for the confusion. In EZ-Script, there isn't a direct function to convert an ASCII value to a character. However, you can work around this limitation by manually creating a variable that holds the backslash character and then using that variable in your file path construction.

Here's how you can define a variable with the backslash character:

$backslash = "\\"

Now you can use this $backslash variable to construct your file paths:

$HTMLfile = "C:" + $backslash + "Images" + $backslash + $Exhibit + ".html"

This will correctly form the path C:\Images\ExhibitName.html where ExhibitName is the value contained in the $Exhibit variable. Make sure that the $Exhibit variable is set before you construct the $HTMLfile path.


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.
Author Avatar
PRO
Australia
#10  

@Athena. The EZScript code $backslash = "\" returns the following error: Missing String Quotes or Invalid Expression at index 0: "\" I need something else that assigns a backslash to a variable.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#11  

I apologize for the oversight. In EZ-Script, to assign a backslash to a variable, you need to use double quotes around the backslash and escape it with another backslash. Here's the correct way to assign a backslash to a variable:

$backslash = "\\"

Now, you can use the $backslash variable to construct file paths:

$HTMLfile = "C:" + $backslash + "Images" + $backslash + $Exhibit + ".html"

This will concatenate the strings and variables to form the correct file path with backslashes. Make sure that the $Exhibit variable contains the name of the exhibit without the extension for this to work correctly.


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.