Ich schrieb einen Befehl, der einen Text sendet, aber es funktioniert nicht, obwohl wenn ich den Befehl einfügen in es tut. Gibt es einen Syntaxfehler oder etwas, das ich vermisse?Golang exec osascript nicht aufrufen
Der gedruckte Befehl lautet: /usr/bin/osascript -e 'tell application "Messages"' -e 'set mybuddy to a reference to text chat id "iMessage;+;chatXXXXXXXXXX"' -e 'send "test" to mybuddy' -e 'end tell'
mein Code:
command := fmt.Sprintf("/usr/bin/osascript -e 'tell application \"Messages\"' -e 'set mybuddy to a reference to text chat id \"%s\"' -e 'send \"%s\" to mybuddy' -e 'end tell'", chatid, message)
fmt.Println(command)
exec.Command(command).Run()