I don't know if the issue lies with me or with OS X
.
I have this AppleScript:
tell application "Caffeine"
if active then
turn off
else
turn on
end if
end tell
I translated this to this JavaScript
caffeine = Application("Caffeine");
if (caffeine.active)
{
caffeine.turnOff();
}
else
{
caffeine.turnOn();
}
However caffeine.turnOn();
is never executed, no matter how often I run it. If Caffeine is active, it is turned off, otherwise nothing. The AppleScript equivalent runs. caffeine.turnOn();
and caffeine.turnOff();
by itself also run fine. I can't imagine, that JavaScript for OSA is really this broken, that even this doesn't work.