I need to launch another app with folderitems (could be one, could be many).
Using FolderItem.Launch it seems you can only send a string.
So I tried to pass the FolderItem full path but that doesn’t seem to work because it passes an array of strings sliced by spaces.
For example if the folderitem path is “/test 2/file name.txt” , it sends the strings “/test” ,“2/file” , “name.txt” to the app.
Is there a good way to launch another app and send FolderItems?
BTW its for macOS only.
I think wrapping your path with double quotes should do it.
path = """/test 2/file name.txt"""
Thanks for the reply.
A forgotten to add I already tried this by using chr(34)+"/test 2/file name.txt"+chr(34)
It keep splitting the string.
I use NSWorkspace (available in macosLibrary), which is supported also by sandbox.
I didn’t know NSWorkspace can launch apps with additional folderitems. Odd. Will look at this.
It seems I need NSWorkspace func openFile(String, withApplication: String?)
But it doesn’t seems to be possible send more than one file and open the Application.
Got it working with NSWorkspace
But stills fails to open more than one file with the application. I tried to send an FolderItem array but that gives an error.
EDIT: Iterating through the folderItem array and use NSWorkspace.openfile for each array item does seem to do the trick.
Thanks Carlo for the pointer !