Script broke after Mountain Lion

Discussion in 'Mac Programming' started by peregrinare, Aug 23, 2012.

  1. peregrinare macrumors newbie

    Joined:
    Mar 4, 2012
    #1
    Hi,

    Hope you guys can help. I googled and checked this forum, but no luck. Please see below. I did turn on "Enable access for assistive devices." Thanks.


    The following used to work:

    tell application "System Events" to get name of process whose frontmost is true

    Now I get this error:

    error "Can’t get name of process." number -1728 from name of «class prcs»
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    I get the same error and I'm running Leopard. Don't know if this is what you want but this works :

    Code:
    tell application "System Events" to get name of every process whose frontmost is true
     

    Attached Files:

  3. chown33, Aug 24, 2012
    Last edited: Aug 24, 2012

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    I see the same error on Tiger and Snow Leopard.

    I see no way the originally posted code could work. There's a word missing before "process". Qualifiers like "first" or "last" would work, and they have the same result. Leaving the word out doesn't work.

    This also works:
    Code:
    tell application "System Events" to get name of processes whose frontmost is true
    
    Note the plural processes, not the singular. And the output is a list, not a single string.
     

Share This Page