![]() ![]() □īut the lack of documentation is a problem for sure. this feels a little hacky, and I would love to find the correct way to do this. #INSTALLBUILDER EXECUTE A SCRIPT ON CLICK OF BUTTON MAC#Not sure if this is something e can copy and execute on another Mac though. I just copied osascript ( /usr/bin/osascript) and renamed it to " whateverwewant" and there it is. Regarding your other point of curiosity, I will follow up by DM right away! Maybe we can help each other (if interested better discussed by email of course □ ).Īs you know, the project I tested with VMware InstallBuilder was on Monterey 12.4, and they still have a way in which they have managed to get it to work.Ī thrilling challenge to figure this out, with such limited documentation and of course, no official support! just a curiosity question: what kind of company are you running. Whichever solution we're looking at, would be a secondary program or script started by the main application, for example like I did with osascript.Īnyhoo. However, I do not think an application can elevate itself any more (with the security changes done by Apple in the last 2 big OS changes - as of Big Sur I believe). Posted by: did read your project saying " Build an example in Lazarus for macOS which elevates itself upon launch using the AuthorizationExecuteWithPrivileges API.". How do you think are they able to manage to display the correct application name in the elevation dialog? We are getting extremely close, in figuring out what they are doing and how they are doing it. Their version says " whatever I have named my application wants to make changes". Our version says " osascript wants to make changes". I haven't yet had a chance to look at this in the implementation stage, but should be able to do so later today. Meaning: just write a config file? Or more complex things? On that note: I'm not sure what you'd like to do with these elevated applications. Starting that same application with osascript from another application (made with Lazarus) then it seems to fail (Console gives a hint that the called application then actually crashes?).Lazarus applications that use Cocoa can be started with elevated rights from Terminal.Each script we start will ask for authentication though. AppleScript can be executed with elevated rights, even from Lazarus with RunCommand.Maybe you'd like to do some testing with that. ![]() ![]() we do see a familiar icon in the authentication dialog. So we could try having our main program start hidden, and use runcommand to tell osascript to start the application with elevated rights. ![]() osascript -e 'do shell script "./simple" with administrator privileges' However if I start it like this, it DOES work (and asks permission only once) from Terminal. this of course fails when started normal. app bundle!) that creates a directory /Library/Application Support/Test2. This way we may be able to call a standard Lazarus application as well and run it with elevated privileges. Procedure TForm1.Button2Click(Sender: TObject) Procedure TForm1.Button1Click(Sender: TObject) One button to create the director and one to remove it (including content): unit Unit1 Ĭlasses, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls So I tested this with osascript (AppleScript) again in Lazarus (uses the unit process). The icon gives the idea that a shell command is being executed with elevated rights. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |