See my AppleScript wrapper runAS from Xojo + Alfred (uses MBS plugin). Or have a look at the MBS plugin directly.
You need to ask for the permissions and you need a reason. Don’t forget to codesign your app. Also keep a built version of your app around or the permissions will be deleted.
That’s why I said to look at the plugin at least for the plist and the reason. But I don’t know how to ask for permissions without plugin.
Yes, you need to codesign anyways or you will go bonkers when you have to give the permissions for every debug run. And also yes, even during debug tests. If there is no app then the permissions are removed.
This is my sub routine when the user clicks a check box:
//When switching this option, ask for admin password first
dim p_s1 as Shell
dim ShResult as String
dim OldValue,DotheSwitch as Boolean
OldValue=PrefsSecuremode
app.LastMethod = “PrefsWindow.PrefsSecureCheckbox.Action”p_s1= new Shell
'p_s1.Execute “osascript -e ““do shell script "“ls"” with administrator privileges”””
'p_s1.execute “osascript -e ““tell application "“Finder.app"” to activate”””
p_s1.Execute “osascript -e ““do shell script "“echo hello"” with administrator privileges”””
ShResult= p_s1.Result
#if DebugBuild then MessageDialog.Show "Debugbuild: " + ShResult
'if mid(p_s1.result,i,15) = “execution error” then'
//wrong password
'end if
DotheSwitch= True
if ShResult.IndexOf(“execution error”) <> -1 then
DotheSwitch= false
end if
if DotheSwitch= True then
if PrefsSecuremode= True then
PrefsSecuremode= false
'MessageDialog.Show “false”
elseif PrefsSecuremode= false then
PrefsSecuremode= True
'MessageDialog.Show “True”
end if
else
PrefsSecuremode=OldValue
end if
if PrefsSecuremode= True then
me.Value= True
elseme.Value= false
end if
p_s1.Close
This method requires a shell.
Unfortunately, the user sees “Osascript wants to make changes” when being asked for the administrator permission.
May i ask: Which property, which list?
This may was the “Solution” for you, but maybe not for someone reading this thread in the future seeking for “Solution”.
I had , because of unknown, also probs the my simple Mac XOJO app try using the camera of my MacBook Pro didn’t work.
Found in MBS doku that I need to add an .plist file (drag into XOJO editor, that’s all) which tells the app asking for access privileg dialog using camera (or not).