Is there a way to tell Folderitem.Launch which app to use for opening?
I’ve got Filemaker 13 and 16 on the computer. Even if Filemaker 16 is open my computer uses version 13 when I use Folderitem.Launch. Very likely only my own problem since the users won’t have multiple version of Filemaker installed. Annoying for development, though. I could use an AppleScript but surely there is a simpler possibility.
I don’t know of a way to do this with FolderItem, but you may have success with a shell in the following way:
dim executable as folderitem = get_folderitem_to_bundle.child("Contents").child("MacOS").child(<name>)
dim sh as new shell
sh.mode=0
sh.execute executable.shellpath+" "+document.shellpath+" >/dev/null 2>&1 &"
[code] dim app as FolderItem = SpecialFolder.Applications.child(“TextEdit.app”)
dim document as FolderItem = SpecialFolder.Desktop.child(“PrincessOfMars.txt”)
app.Launch(document.NativePath)[/code]
I don’t have FileMaker, but I believe what I did with TextEdit will work with FileMaker. Instead of launching the document, you launch the application, and provide the path to the document to open.
Does this work for macOS. I have an app which manages a folder full of HTML files. I want the option to call an editor, BBEdit, from the app.
I wrote
htmlEditor = GetFolderItem(prefString, FolderItem.PathTypeNative) // Get folderItem for BBEdit.
if htmlEditor <> nil and htmlEditor.Exists then
docItem = GetFolderItem(homeFolder.Text + “/” + me.Cell(row, column), FolderItem.PathTypeNative) // Get folder item for source
if docItem <> nil and docItem.Exists then
htmlEditor.Launch(docItem.NativePath)
Return
end if
This launches BBEdit but does not open the file. The reference does seem to suggest passing a parameter is only on Windows and Linux but the thread I’m adding this to is for macOS.
Has something changed in the interim.
No I didn’t. But I did have a problem getting BBEdit to open a file from the doc in macOS. BBEdit support said it was a bug in the doc and they were trying to work round it.
I copied the code I was using from the thread I added my request to.
Are you saying the BBEdit documentation mentions this issue, if so what should I search on?
I’m not certain what the BBEdit doc says, but you can open a document with a specific app by using a declare on Mac. It’s floating around the forum somewhere.
Ok, I get that. As I said earlier the documentation on Launch suggests that but
this particular forum thread is macOS
and
Beatrix who started this conversation is being advised by Michel to code
app.launch(folderitem.nativePath)