
executescripttext with file name

hegedus
Hi,
I am working on some cross platform issues integrating with Python.
I am using (or attempting to use) ExecuteScriptText to run a shell script on the Mac and a bat file on Windows
On the Mac I create a string:
Do shell script "'fullpath/to/file.sh'" with single quotes to accommodate
On Windows I use parsefilepath(5,thelocation,"\\",0,0) to define the file path but am running into trouble.
The file path is "C:Users\andy.hegedus\Desktop\Texture Classifier\Run_Python.bat" as the string.
Do I have to worry that the slashes are being interpreted as escape codes such as the \R into the operation, ExecuteTextScript or will it be interpreted as a legal file path?
Andy
Here is a snippet of code that I used LONG ago for creating and running batch files. Not sure if this is helpful, but it did work for me. There are likely built-in functions that can replace the ugly path conversion functions.
September 22, 2023 at 12:14 am - Permalink
Andy,
I haven't used "ExecuteScriptText" for quite some time, so relying on the help file it looks like you need to escape the backslashes in the file path:
I thought there was a function to convert a path to the escaped version, but could not find such a thing. You could try "ReplaceString" to replace a single backslash with a double backslash.
ReplaceString("\", thelocation, "\\")
September 22, 2023 at 06:08 am - Permalink