Ich betreibe versuchen Apple Befehl von Swift Code wie folgt auszuführen:Swift/Apple: Kann Apple Skript von Swift Code
var appleScriptCmd = "tell application \"System Events\" to make login item at end with properties {path:\"" + appPath + "\", hidden:false, name:\"Some App\"}";
var appleScriptCmd2 = "tell application \"System Events\" to set visible of process \"Safari\" to false";
und dann habe ich versucht, beide:
let script = NSAppleScript(source: appleScriptCmd2)!;
var errorDict : NSDictionary?
script.executeAndReturnError(&errorDict)
if errorDict != nil { print(errorDict!) }
oder ältere Ansatz :
funktioniert nicht und gleichzeitig beide Befehle, die ich ausprobiert habe, arbeiten aus Terminal-Programm mit osascrip t -e "ein Befehl" -Tool.
Der Code soll funktionieren. Ist die App Sandboxed? – vadian
Was bedeutet Sandboxed? –
Ich habe in Project Settings> Capabilities App Sandbox aktivieren, aber ich verwende die App normal durch Drücken der Play-Taste (ohne Archiv) –