How to detect the OS with ExtendScript?
Copy link to clipboard
Copied
I'd like to detect the Operating System that After Effects in running on with ExtendScript. Maybe there is an object method that returns a string with an identifier? Is this possible, and if so, how is it acheived?
Thanks for your help!
Copy link to clipboard
Copied
Sorry just found it in the guide. My apologies.
Example
alert ("Your OS is " + system.osname + " running version " + system.osversion); confirm("You are: " + system.userName + " running on " + system.machineName + ".");
Copy link to clipboard
Copied
I remember something different from what you give in the example. First I think osname spells with an uppercase "N": system.osName, but I also believe that it can sometimes return an empty string.
I think it's safer to use first system.osName and then $.os if the string was empty.
Copy link to clipboard
Copied
I think it is moved to $ object.
Sample |
---|
alert($.os); |
Thank you,
Naoki
Copy link to clipboard
Copied
Hey! Just a random subquestion. In what way is $ useful? I found it mentioned 3 times in the guide. -> They say 3 things about it:
that it is
global debugging object, whatever that means,
$.locale designated the operating systems language,
$.os is the operating system name
Is that it? Is there some other functionality I am not aware of?
Copy link to clipboard
Copied
TimSx​
$ object is noted Helper object.
If you check on Data Browser in ESTK, you may find something useful for you.
Copy link to clipboard
Copied
To get more info about the object, you can always reflect its properties and methods:
var properties = object.reflect.properties.join(",\n");
var methods = object.reflect.methods.join(",\n");
Just change object to whatever AE object you want to reflect.
Copy link to clipboard
Copied
There's about 5 pages on the $ object in the JavaScript Tools Guide. My favorite function is probably $.writeln(), which I use extensively during debugging.
Dan
Copy link to clipboard
Copied
Thank you all!

