i have a Exeapp which opens files such as xls, doc, jpg, ect …
how is it possible to open files with Spaces in the file name … ?
i read somewhere by surrounding the name of the file with single quotes: character 39, it should do the trick, the 39 character doesn’t seem to work
if i go to finder and double click on a file with spaces the associated editor / viewer will open the file.
this code fails with filenames with spaces. ( folders and directories also )
The editor opens with a blank document / new screen, the appArg does not load
Dim sh As New Shell
sh.Execute "open -n " + AppPath.ShellPath + " --args " + Chr(39) + appArg + Chr(39)
This code will work with filenames with no spaces.
Dim sh As New Shell
sh.Execute "open -n " + AppPath.ShellPath + " --args " + appArg
Try using single quotes directly from your keyboard instead of chr(39). You may be getting some unintended encoding issues there.
Dim sh As New Shell
sh.Execute "open -n " + AppPath.ShellPath + " --args " + appArg +
Also, if AppArg is a path and youre putting it in quotes, you should use NativePath instead of ShellPath and each argument should be enclosed in quotes, not all of them together.
Emile ::: please see an example of ExecApp ( execute other app )
Dim editor As FolderItem
editor = New FolderItem(MainWin.SpreadSheet.Text, FolderItem.PathTypeNative)
MainWin.ExecApp(editor, Mainwin.LocalPathSelector.Text + "/" + File)
Greg i did use single quotes using Chr(39)…
Single Quotes from the Keyboard does not seem to work either, even if the file has no spaces.
but … Args in Native ? ok i’ll try it.
Eli::
the path of the outside App to run has no problem with spaces,
it is the AppArg the argument to the outside app that is the problem if it has spaces.
The AppArg is the file for the other app ( outside app ) to open.
Dave::
here is the exact string displayed by MSGBOX
open -n /Applications/Microsoft\\ Office\\ 2008/Microsoft\\ Excel.app --args '/Volumes/Production/culser/Sites/non_adult/shop/_production/_warnings/This End Up.xls'
here is an interesting development
i am using Gimp to open images
using this code
sh.Execute "open -n " + AppPath.ShellPath + " --args " + appArg.ShellPath
gimp works … spaces or no spaces in the path
I am using sublime to open text files such as txt / html / dat / ini files ect …
sublime works using the same shellpath code …
it seems only the spreadsheet app excel and word do not open files using ShellPath/ nativepath / or encasing in Chr(34)