So, I have this name.sh script with bunch of shell commands. I need to change the wallpaper before ending that script.
I'm using
osascript -e 'tell application "System Events.app" to set picture of every desktop to "/Library/Desktop Pictures/my.jpg"'
at the end of the line. The thing is the Apple Script won't run under root. Because System Events will throw 10810 at first and then 600 (Application isn't running). If I run this osascript under admin user, it will work just fine. The wallpaper will be set.
Let me know how you guys can help me in this!