Mac little problems

I have two small problems with Mac
the first one is how to launch an app
This works:

Dim thea As string = " -nosplash -noshow -load " + iptPath +"temp.ipt.thea -exit" #if TargetWin32 then Dim thea3 As string = "C:\\Program Files\\Thea Render\\thea.exe" #elseif TargetMacOS then Dim thea3 As string = "/Applications/Thea.app/Contents/MacOS/Thea" #elseif TargetLinux then Dim thea3 As string = "/home/nige/TheaRender/Thea" #endif sh.Execute(thea3,thea)

But /Applications/Thea.app doesn’t work
In my application the paths aren’t set in stone, I just used the full paths for clarity
I’m not a Mac user so I don’t know if people are likely to have the app in a different location, which you can do on Windows and Linux

the other thing, is I have two windows that can be open at the same time, I have a “wait” dialog that pops up and prevents the user from clicking or making changes on the other Windows, on Mac this doesn’t work and the wait dialog doesn’t stay on top

that’s it really… otherwise things are going well!

I just looked at the docs for Thea and the command line is

open -a '/Applications/Thea.app' , I did try this last night

Uh oh. Don’t do that on a Mac. First get the path to the app with Launch Services - either with macoslib or MBS. Then do a launch with Folderitem.launch. There is no need to use a shell. Or use a simple AppleScript to launch the application.

How do you show the window on the Mac side? ShowModal?

ShowModal just shows the dialog and none of the processes its waiting for run, so I take it I need to run these processes from that Window as it opens, rather than the button that shows it?

With it having arguments FolderItem it didn’t seem to work also I need to know when Thea exits… I’ll try again though, when I started out I just founds ways to get things working, so I guess they aren’t all the right way lol

You can display a window and use methods in another. It is no problem.

On Mac, you can drag the Thea unix executable into your project, which will tuck it into the bundle, then use that :

dim f as folderitem = app.executablefile.parent.parent.child("Resources").child("Thea")

Then use this to create the path. I added a string called arguments if you need that.

Dim thea3 As string  = f.shellPath+" "+arguments

All files dragged into the project on Mac are accessible that way as read only. For a Unix executable, it is necessary to do that on a Mac since it needs to be set as executable, and permissions can get lost on the PC.

Thanks again Michel I shall give it a try :slight_smile:
Actually I’m going redo the project as there’s things that are duplicated that could be a single method, I was lazy sometimes and forgot to re name controls, properties I should of set that are re used etc etc
everything is “getting there” there’s only the client that I haven’t managed to do… I may have to pay someone lol

Please use the TPSF module from this page to access the resources folder. It uses the correct functions for resolving the Resources folder location of an application bundle.

https://forum.xojo.com/15318-modules-for-you

Thanks Sam