Glad to know, and glad to make someone happy for once.Anyway, I shall be stealing your solution, including the spaces trick
another thorny permissions issue
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: another thorny permissions issue
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
Ah, now you can never say NEVER
Last edited by marksmithhfx on Thu May 25, 2023 10:37 pm, edited 1 time in total.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: another thorny permissions issue
Indeed.Ah, now you can't save NEVER
Though I use Brave for 99% of my needs on Mac OS 12.5,
Opera on Mac OS 10.6.8 and a 'kinky' version of Firefox on Mac OS 10.7.5.
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
Just to top off this discussion, this is what I ended up with in the open card handler (1st thing) so the user generally has to quit Safari to use my app. Even though I've been hammering away at my Safari bookmarks on two laptops, about 10 times a day, for over a month with no obvious corruption or other negative consequence, it's still good practice not to have two different apps dealing with the same output file (when there are no obvious multi-user controls in place). Accidents will happen.
Thanks to everyone for your help on this. It was an important milestone to achieve.
Mark
Code: Select all
-- check if Safari is open
repeat while (shell("top -o rsize -ncols 2 -l 1")) contains "safari "
-- put up dialog
answer warning "Please quit Safari before continuing with this program." with "Cancel" or "Ok"
if it is "Cancel" then quit
end repeat
Mark
Last edited by marksmithhfx on Wed Jul 06, 2022 10:55 am, edited 2 times in total.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 9824
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: another thorny permissions issue
It needs the -n option (number of iterations), with 1 for the value, e.g.: shell("top -n 1")marksmithhfx wrote: ↑Mon Jul 04, 2022 10:00 pmThanks Richard. LC 9.6.8 rc2 usingassuming it goes into the it variable also hangs livecode. Is there an alternative I'm not thinking of?Code: Select all
get shell("top")
But that's not likely to do what you need either, because as wonderful as bash is some programs need the shell context set for a user to call them. I think there's a way to do that from LC (Mark Weider probably knows off the top of his head), but I don't do enough with LC these days to have time to figure that out.
Consolation prize: while this won't help your Mac needs, this is a fun read, a Linux Journal article by Dr Raney from '97 showing how to write a GUI alternative to top, by traversing the /proc directories directly:
https://www.linuxjournal.com/article/2110
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
Thanks Richard... looks like an interesting read. Will take a closer look at it when I get a few minutes later today.FourthWorld wrote: ↑Wed Jul 06, 2022 4:13 amConsolation prize: while this won't help your Mac needs, this is a fun read, a Linux Journal article by Dr Raney from '97 showing how to write a GUI alternative to top, by traversing the /proc directories directly:
https://www.linuxjournal.com/article/2110
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 9824
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: another thorny permissions issue
I found the shell problem tugging at me, so I found the solution:
1. Specify the terminal type in $SHELL (LC's shell runs outside a user context)
2. Specify batch mode ("-b") for non-console use
This works on Linux, and may likely work on macOS but I haven't tested it there:
1. Specify the terminal type in $SHELL (LC's shell runs outside a user context)
2. Specify batch mode ("-b") for non-console use
This works on Linux, and may likely work on macOS but I haven't tested it there:
Code: Select all
put "xterm" into $TERM; put shell("top -bn 1")
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
Thanks Richard. Interesting read. I think I'll try and build a graphical UI to the "top" command using the example he provided. Might not get far, but will be interesting to try.FourthWorld wrote: ↑Wed Jul 06, 2022 4:13 amConsolation prize: while this won't help your Mac needs, this is a fun read, a Linux Journal article by Dr Raney from '97 showing how to write a GUI alternative to top, by traversing the /proc directories directly:
https://www.linuxjournal.com/article/2110
PS have not tried your latest suggestion but while fooling around earlier in bash I did get an error using -b as an unsupported parameter. Such a shame all the bashes have different language elements. Makes finding good examples harder since they don't always translate to the Mac.
Life eh?
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 9824
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: another thorny permissions issue
I don't know how accessible macOS' equivalent to /proc is, but I'm keen to hear what you find.marksmithhfx wrote: ↑Thu Jul 07, 2022 5:42 pmThanks Richard. Interesting read. I think I'll try and build a graphical UI to the "top" command using the example he provided. Might not get far, but will be interesting to try.FourthWorld wrote: ↑Wed Jul 06, 2022 4:13 amConsolation prize: while this won't help your Mac needs, this is a fun read, a Linux Journal article by Dr Raney from '97 showing how to write a GUI alternative to top, by traversing the /proc directories directly:
https://www.linuxjournal.com/article/2110
There are several open source packages that are out of date as shipped with even the latest versions of macOS. This is mostly due to license changes in a project.PS have not tried your latest suggestion but while fooling around earlier in bash I did get an error using -b as an unsupported parameter. Such a shame all the bashes have different language elements. Makes finding good examples harder since they don't always translate to the Mac.
For example, macOS ships with a version of rsync that's many years old, because several years ago rsync moved from GPV v2 to v3, and v3's patent pool clause was apparently a turnoff to a company that derives much of its value from patent encumbrance.
With rsync the downsides are non-trivial: there are many known vulnerabilities logged against the version Apple ships with. Seasoned command-line fans have become accustomed to use third-party packagers to keep up with tools like that.
I don't know if this sort of thing is why -b to trigger batch mode didn't work with top on macOS. I'll see if I can get some time to explore that next week, but if you learn anything in the meantime I'd been keen to hear what you discover.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
Thanks Paul, I have been using your example. I was discussing this the other day with Stam and he suggested some AppleScript he had tested that opened the Privacy panel and highlighted (and selected) the Full Disk Access sub-section.paul@researchware.com wrote: ↑Sun Jul 03, 2022 2:29 pmIf you have a link or a button that executes:
launch url "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles//"
It will open the correct panel. The user still needs to scroll to the Full Disk Access, unlock the setting with their admin password, and manually add the app.
Code: Select all
openURL:(current application's NSURL's URLWithString:"x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles")
Given the reduction in steps, I made a custom dialog to explain what needs to be done to the end user. I'm not saying this is a perfect solution, but it was the best I could come up with. Perhaps this may be of some use to yourself or others. Thanks again for posting your original message as it really got this ball rolling.
PS the image resolution is actually better in the app than it is in this screenshot, or I need new glasses
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
While I am on about custom dialog boxes, and before I make a feature request, does anyone know if anything like the following dialog is supported in LC presently. I think this is what the "standard" dialogs in macOS look like these days, and based on past experience I think rolling your own is the only way to achieve this look. Correct?
Thanks
Mark
Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: another thorny permissions issue
Just use 'sheet'
It creates a window-modal dialog out of a stack centred on the parent window, dims and inactivates the parent window.
Just create a substack (called, say, "alert") and model it as you see fit.
To show, just use:
As this is window-modal you have to include a control to close it. If you get stuck in the IDE you can either close the stack or change it's style to "topLevel", eg with a command in the messageBox.
I'm using this right now and it works great...
S.
It creates a window-modal dialog out of a stack centred on the parent window, dims and inactivates the parent window.
Just create a substack (called, say, "alert") and model it as you see fit.
To show, just use:
Code: Select all
sheet stack "alert"
I'm using this right now and it works great...
S.
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
Thanks Stam. Will give it a go.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: another thorny permissions issue
I forgot to mention that "sheet" will only work this way with MacOS 12 or newer. Older versions of MacOS show the substack as an old-fashioned sheet (ie sliding out of the titlebar and remaining fixed to it, which is not what you're after).
As of MacOS 12 the HIG for 'sheet' has changed to be a centred window-modal as described above.
Read more about the HIG here: https://developer.apple.com/design/huma ... on/sheets/
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: another thorny permissions issue
I'm on 12 so that works. However, we'll see what kind of response we get in beta testing. I am actually hoping to put this app into the new macOS TestFlight program and distribute beta's from there. Anyone have any experience with that?
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS