Skip to main content
Masoud.Ghazi
Participating Frequently
June 17, 2017
Question

Get MAC address with extendscript

  • June 17, 2017
  • 1 reply
  • 1437 views

I found a code for getting MAC address.

it works on win but not work on mac os.

Where is the mistake?

var name;

    if($.os.indexOf('Macintosh')!=-1){

       

        name = system.callSystem("ifconfig en1 | awk '/ether/{print $2}'");

       

        name = name.replace (/[:]/g, "");

    }else{

        var name = (system.callSystem("getmac"))

        name=name.replace("\n",'')

        var patt = /[0-9A-Z]-[0-9A-Z]{2}-[0-9A-Z]{2}-[0-9A-Z]{2}-[0-9A-Z]{2}-[0-9A-Z]{2}/ig;

        name = patt.exec(name);

        name = name[0]

        name = name.replace (/[-]/g, "");

    }

    name = name.replace("\n",'');

    name = name.replace (/0/g,"k");

    name = name.replace (/1/g,"N");

  alert( name);

This topic has been closed for replies.

1 reply

Mathias Moehl
Community Expert
Community Expert
June 19, 2017

What do you mean with does not work? On my Mac it seems to work fine. What result do you expect and what result do you get?

On the machine where it does not work, does it work when you execute this manually in the command line?

ifconfig en1 | awk '/ether/{print $2}'

Cheers,
Mathias

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Masoud.Ghazi
Participating Frequently
June 19, 2017

Thank you for answering.

I didn't have mac device and I tested it on virtual MAC OS.

I wrote a script with 2000 line of code.

I fear that some of these codes not working on MAC OS when I tested the code above on virtual MAC OS and not working.

Thanks again.

Masoud

Masoud.Ghazi
Participating Frequently
June 19, 2017

and which codes is different syntax between win and mac OS?

Thank you very much