Ok I’m having problems with spaces in a path name, in the below example iptPath the text field which the user has defined as their save Path, on Mac I just added a single quote and it works fine but the script fails on Windows, the exe starts but fails as it can’t get its head around the space
What has me puzzled is my C# had no issues with adding either double quotes or single
This is the Mac version with the single quotes between +iptPath +“Script.ipt.thea”
I don’t have a problem launching Thea which is in “Program Files” which is weird
[code] Dim iptPath as string = Savetxt.Text
Dim thea As string = " -nosplash" +noshow +" -load " +"’" +iptPath +“Script.ipt.thea” +"’" + " -exit"
#if TargetWin32 then
Dim thea3 As string =TheaPath.Text+ “thea.exe” #elseif TargetMacOS then
Dim thea3 As string =TheaPath.Text+ “Thea” #elseif TargetLinux then
Dim thea3 As string =TheaPath.Text+ “thea” #endif
Dim sh As New Shell
sh.Mode = 1
If it still does not work, try placing your iptPath in a textfield so you can see exactly what the result is, and experiment in the Command Prompt manually until you get the syntax right.
Inspecting command line
Executing command line
Failed during parsing message "Load C:\\Users\
ige\\Documents\\a"
Error at line 1: message "Load C:\\Users\
ige\\Documents\\a"
Finished in 0 seconds!
The path that is getting sent looks right:
IF there’s no spaces it works great and does everything its supposed to do… it wasn’t until I gave a beta tester it to try that I noticed it… I don’t use folders with spaces or files
Inspecting command line
Executing command line
Failed during parsing message "Load C:\\Users\
ige\\Documents\\a"
Error at line 1: message "Load C:\\Users\
ige\\Documents\\a"
Finished in 0 seconds!
The path that is getting sent looks right:
IF there’s no spaces it works great and does everything its supposed to do… it wasn’t until I gave a beta tester it to try that I noticed it… I don’t use folders with spaces or files[/quote]
The only way you will be able to solve that is to experiment with the interactive Command Prompt application until you get it to work, and only after build your string properly in Xojo.
It fails to start Thea with double quotes
I’m going to leave it and take a look next week, I’d been on this two days before I asked lol and now I’m losing the will to live… can’t believe something that is in 5 different projects can be such a problem
For a “quick fix” I’ve made it save/open the file from the application folder, the XML files that it subsequently loads aren’t proving a problem… at least I can now get it out for testing and worry about this hiccup at my leisure
I just worked with a Windows path for another thread, and I realize we do not know how iptPath is created. FolderItem normally reports a short path (Dos path) so it contains no spaces. I bet iptPath is created using NativePath which is the “long path” with spaces. Switch to shellPath and it will work right away.
This whole thread got messed up but I think the code you posted originally will work fine (as you indicated), if you fill iptPath with shellPath. This turns the path with spaces into the Dos path (in your original post) :
dim f as folderitem = GetFolderItem(Savetxt.Text)
Dim iptPath as string = f.shellpath
Dim thea As string = " -nosplash" +noshow +" -load " +"'" +iptPath +"Script.ipt.thea" +"'" + " -exit"
That is precisely the point : TheaPath.Text is most probably a field where the user enters the long path which contains spaces. By adding dim f as folderitem = GetFolderItem(Savetxt.Text) it sets f to that path, which converts iptPath to f.shellpath which is the short (Dos) version which contains no path, so extra quotes become unnecessary.