4

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

juergen d
  • 201,996
  • 37
  • 293
  • 362
Nextyoyoma
  • 41
  • 1

2 Answers2

0

Don't know if this is still a problem but if it is it would be a fairly trivial external to write.. Something based on this:

for (NSRunningApplication *currApp in [[NSWorkspace sharedWorkspace] runningApplications]) {
        if ([currApp isActive]) {
             // return whatever property you want here
        }
    }
Monte Goulding
  • 2,380
  • 1
  • 21
  • 25
0

Make sure that the owner of the script is system or root and not you. You can use the chown command line utility to do this (this is included in Mac OS X). 10.7 and later is rather picky about permissions.

Mark
  • 2,380
  • 11
  • 29
  • 49