Folderitem.Launch with specific app

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 &"

In the Finder, Get Info on a FileMaker Document and set its default application (open that pane in the Get Info window) to FileMaker 16.

But then, each tima you double click in a FileMaker document it will launch version 16 too.

If you use macOSlibrary (32 and 64 bits), there is a specific method to accomplish to open a file with apps of your choice.

[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.

@Michel Bujardet : thanks, that did it!

@Emile Schwarz : of course, but I need to make sure that my solution works with both 13 and 16 and I don’t want to switch every time in Finder.

@Thomas Sanham: thanks for the alternative solution.

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.

Jack

This is a BBEdit thingy. Did you make a search in BBEdit documentation for that feature ?

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?

Jack

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)