Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to detect the OS with ExtendScript?

Participant ,
Mar 01, 2013 Mar 01, 2013

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!

TOPICS
Scripting
3.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 01, 2013 Mar 01, 2013

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 + ".");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 13, 2013 Mar 13, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 01, 2017 Sep 01, 2017

I think it is moved to $ object.

Sample
alert($.os);

Thank you,

Naoki

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 02, 2017 Sep 02, 2017

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 02, 2017 Sep 02, 2017

TimSx​

$ object is noted Helper object.

If you check on Data Browser in ESTK, you may find something useful for you.

capture_20170902_153351.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 02, 2017 Sep 02, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 02, 2017 Sep 02, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 03, 2017 Sep 03, 2017
LATEST

Thank you all!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines