can someone make simple example with AuthorizationMBS of mac program, that works like normal mac-app with lock and unlock button.
So it ask admin password when unlocked and then it can run authorized shell commands until its locked again.

I’ve tryed but seems to be much too complex for my brains.

Tryed something like this and it kind of work :slight_smile:
Sometimes it ask password when unlock and sometimes when executing.
Can’t figure out…

function for unlock:

[code]Function doAuth() As Boolean
dim Flags as integer
a=new AuthorizationMBS
a.KeepRights = True
iset=new AuthorizationItemSetMBS
i=new AuthorizationItemMBS
iset.Append i

if a.NewAuthorization(nil,a.kAuthorizationFlagDefaults) then // create

if a.LastError = 0 then
  Return True
  Return False
end if

Return False
end if
End Function

Execute action:

dim e as integer s.Append "-10" s.Append "/var/log/system.log" a.Execute("/usr/bin/tail",s,True) if a.LastError<>0 then MsgBox "Lasterror on Execute: "+str(a.LastError) else e=a.Wait // wait for process to terminate. Returns PID if a.LastError<>0 then MsgBox "Lasterror on Wait: "+str(a.LastError) end if end if TextArea1.text=a.ReadStream(1024) ReDim s(-1)

a, i, iset, s(-1) are properties of window1.



Have you tried asking Christian for help with his plugin?
If it’s asking for authorization while you’re executing the shell your manual authorization did not succeed.

Well, I thought that asking here might help others too.