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

How to read the operating system with a javascript

Explorer ,
Jun 02, 2020 Jun 02, 2020

Copy link to clipboard

Copied

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

Views

636

Translate

Translate

Report

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();
}

Votes

Translate

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.

Votes

Translate

Translate
Community Expert ,
Jun 02, 2020 Jun 02, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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