Friday 20 August 2021

OSX Yosemite - JavaScript for Automation Accessing Enums

I'm starting to try converting some of my AppleScripts into JavaScript in OS X Yosemite, but I don't understand how I'm supposed to access enums from applications. For example - the status of Adium.

In AppleScript:

tell application "Adium"
    if status type of global status is offline then
        log "offline"
    end if
end tell

In JavaScript I do not know how to access the "offline" enum:

if(Application('Adium').globalStatus.statusType == ?????) {
    console.log("offline");
}

I've tried simple things like "offline" without success. All these are errors:

Application('Adium').StatusType("offline"); // error
Application('Adium').StatusType.offline;     // undefined
Application('Adium').StatusType.make({name:"offline"}); // error

Anyone gotten something like this working?



from OSX Yosemite - JavaScript for Automation Accessing Enums

No comments:

Post a Comment