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

How to read the operating system with a javascript

Explorer ,
Jun 02, 2020 Jun 02, 2020

Hi,

I would need to change in After Effects the path to the output directory depending on the operating system. If the script will run on a MAC the path will be different than the path on a PC.

Is there a way to read in the javascript which operation system I am on?

Cheers!

TOPICS
Expressions , Resources , Scripting , SDK
865
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

correct answers 2 Correct answers

Community Expert , Jun 02, 2020 Jun 02, 2020
function isWindows(){
return $.os.indexOf("Windows") != -1;
}


/* \brief returns true if we are on a Mac system */
function isMacOS(){
return !isWindows();
}
Translate
Explorer , Jun 02, 2020 Jun 02, 2020

That's very cool!

Thank you very much Mathias!

I also wanted to share how I was able to use it in my script.

//alert($.os);
if($.os.indexOf("Windows") > -1){
    var strOS = "Windows";
}else if($.os.indexOf("Macintosh") > -1){
    var strOS = "Mac";
}
alert(strOS);

A.

Translate
Community Expert ,
Jun 02, 2020 Jun 02, 2020
function isWindows(){
return $.os.indexOf("Windows") != -1;
}


/* \brief returns true if we are on a Mac system */
function isMacOS(){
return !isWindows();
}
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
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
Explorer ,
Jun 02, 2020 Jun 02, 2020
LATEST

That's very cool!

Thank you very much Mathias!

I also wanted to share how I was able to use it in my script.

//alert($.os);
if($.os.indexOf("Windows") > -1){
    var strOS = "Windows";
}else if($.os.indexOf("Macintosh") > -1){
    var strOS = "Mac";
}
alert(strOS);

A.

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