I have a LiveCode app that, as part of a larger purpose, checks to see what the name of the "frontmost" application (i.e. the name in the menu bar). I am having LiveCode run this through the shell:
osascript -e 'tell application "System Events" to return name of every process whose frontmost is true'
It works fine when the app runs as a normal process, but when it is started by launchctl as a daemon, it doesn't work. I get the error
61:68: Syntax error: expected classname but found identifier (-2741).
Like I said, it only happens when the app is running as a daemon. Any ideas why?
btw: OS X 10.7.4