Runprograme on big sur
Runprograme on big sur
Hi
After updating to Big Sur on Mac. I am finding that my app which used to open 'TextEdit' with the following line no longer works.
RunProgram(GetUserDirectory(#PB_Directory_Programs)+"TextEdit.app","","")
it appears to open 'textedit' briefly, then immediately closes it. and the return result also shows that it opened ok.
any ideas. or is this a bug?
I have tried opening different apps with RunProgram, but most seem to close immediately.
I have also noticed that if I do have an app the will successfully open using 'RunProgram', it would work when run from the IDE, but once my program is compiled it then runs into the same issue of closing down the programe that was opened with RunProgram".
it all used to work nicely before updating to Big Sur. So I assume this is where my problems are coming from.
I think all that made sense lol
Martin.
After updating to Big Sur on Mac. I am finding that my app which used to open 'TextEdit' with the following line no longer works.
RunProgram(GetUserDirectory(#PB_Directory_Programs)+"TextEdit.app","","")
it appears to open 'textedit' briefly, then immediately closes it. and the return result also shows that it opened ok.
any ideas. or is this a bug?
I have tried opening different apps with RunProgram, but most seem to close immediately.
I have also noticed that if I do have an app the will successfully open using 'RunProgram', it would work when run from the IDE, but once my program is compiled it then runs into the same issue of closing down the programe that was opened with RunProgram".
it all used to work nicely before updating to Big Sur. So I assume this is where my problems are coming from.
I think all that made sense lol
Martin.
Re: Runprograme on big sur
I have experienced the same problem already but also on Mojave and Catalina. Which was your previous MacOS version?MBall wrote:After updating to Big Sur on Mac. I am finding that my app which used to open 'TextEdit' with the following line no longer works.
RunProgram(GetUserDirectory(#PB_Directory_Programs)+"TextEdit.app","","")
it appears to open 'textedit' briefly, then immediately closes it. and the return result also shows that it opened ok.
any ideas. or is this a bug?
I have experienced this problem in Finder when double-clicking on some files with the extension .Txt. The solution has always been to start TextEdit from Applications > TextEdit.app or from the TextEdit.app copied to the Dock. After launching TextEdit in one of these two ways, I opened the problematic text file using the menu option "Open..." and saved it with "Save". After this action in most cases it was possible again to open the problematic text file by double-clicking it in Finder.
Re: Runprograme on big sur
Previous OS was Catalina. That just worked fine.
It's not just 'TextEdit' that opens and then immediately closes. using 'RunProgram' with other apps does the same thing.
Martin.
It's not just 'TextEdit' that opens and then immediately closes. using 'RunProgram' with other apps does the same thing.
Martin.
Re: Runprograme on big sur
There are two way to use it.
or
GetUserDirectory(#PB_Directory_Programs) returns /Users/yourName/Applications/ and this is not the path where the most applications are.
Normally on macOS the application are in /Applications and not inside the user specific application folder.
Code: Select all
RunProgram("open", "/Applications/TextEdit.app","")
Code: Select all
RunProgram("/Applications/TextEdit.app/Contents/MacOS/TextEdit","","")
Normally on macOS the application are in /Applications and not inside the user specific application folder.
macOS Catalina 10.15.7
Re: Runprograme on big sur
Hi Woldram.
Thank you for your response.
I've already tried both of those. but no joy. the example I posted, was the last one I tried in my code.
as I said previously, it works Pre 'Big Sur'. On 'Big Sur', the TextEdit app does open, but then immediately closes.
I get the same result with other apps too.
Martin.
Thank you for your response.
I've already tried both of those. but no joy. the example I posted, was the last one I tried in my code.
as I said previously, it works Pre 'Big Sur'. On 'Big Sur', the TextEdit app does open, but then immediately closes.
I get the same result with other apps too.
Martin.
Re: Runprograme on big sur
Do you have the same problem when double-clicking the file in Finder? If yes, have you tried my proposed solution already?MBall wrote:as I said previously, it works Pre 'Big Sur'. On 'Big Sur', the TextEdit app does open, but then immediately closes.
Shardik wrote:The solution has always been to start TextEdit from Applications > TextEdit.app or from the TextEdit.app copied to the Dock. After launching TextEdit in one of these two ways, I opened the problematic text file using the menu option "Open..." and saved it with "Save".
Re: Runprograme on big sur
works fine when launched from finder.
it's not just TextEdit. Seems most apps start.
then immediately close.
it's not just TextEdit. Seems most apps start.
then immediately close.
Re: Runprograme on big sur
Like Wolfram already told you, your way of launching applications is wrong, no matter the macOS version.
This would never work, even if you'll put your TextEdit to your /Users/user/Applications/ folder.
And you can't even rely on /Applications in general anymore, because it can be /System/Applications now. I suggest using that:
Or, in case you want to launch the needed app manually, use URLForApplicationWithBundleIdentifier method of NSWorkspace to get its real path.
Code: Select all
RunProgram(GetUserDirectory(#PB_Directory_Programs)+"TextEdit.app","","")
And you can't even rely on /Applications in general anymore, because it can be /System/Applications now. I suggest using that:
Code: Select all
RunProgram("open","-a TextEdit","")
RunProgram("open","-b com.apple.TextEdit","")
Re: Runprograme on big sur
ok. i'll try to explain again.
The application i launch using 'RunProgram' does actually start in the background. but the problem is, the launched application immediately closes, as if the OS is shutting it down for some reason.
The application i launch using 'RunProgram' does actually start in the background. but the problem is, the launched application immediately closes, as if the OS is shutting it down for some reason.
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: Runprograme on big sur
Running BigSur and had the same problem used the suggestion above:-Wolfram wrote: ↑Sun Mar 14, 2021 11:10 am There are two way to use it.
orCode: Select all
RunProgram("open", "/Applications/TextEdit.app","")
GetUserDirectory(#PB_Directory_Programs) returns /Users/yourName/Applications/ and this is not the path where the most applications are.Code: Select all
RunProgram("/Applications/TextEdit.app/Contents/MacOS/TextEdit","","")
Normally on macOS the application are in /Applications and not inside the user specific application folder.
Code: Select all
RunProgram("open", "-a TextEdit","")
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.