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 EZ-B v4

ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

PRO
Canada
#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.
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.

PRO
Canada
#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.