Copy link to clipboard
Copied
Hi,
is there a platform independent way to get the machine MAC Address via ExtendScript?
I've found this one but apparently it's Win only (and uses VBScript, which InDesign can call using app.doScript() which we don't have in PS)
Get network adapter Name/MAC/Speed | IndiSnip [InDesign® Snippets]
Thank you very much in advance,
Davide Barranca
---
On Windows, do
app.system("getmac > /tmp/mac"); $.sleep(1000);
and parse the output.
On OS X, do
app.system("networksetup -listallhardwareports > /tmp/mac"); $.sleep(1000);
and parse the output.
The sleep() calls are because app.system() call executes the command line asynchronously.
I haven't tested it but it looks close.
Copy link to clipboard
Copied
On Windows, do
app.system("getmac > /tmp/mac"); $.sleep(1000);
and parse the output.
On OS X, do
app.system("networksetup -listallhardwareports > /tmp/mac"); $.sleep(1000);
and parse the output.
The sleep() calls are because app.system() call executes the command line asynchronously.
I haven't tested it but it looks close.
Copy link to clipboard
Copied
Thank you x,
on the HTML Panel side I've also found this node module which seems to work pretty well too (even if ExtScript is safer): getmac
I've tested the OSX and works good, thanks! I assume the Win does too.
Davide
Copy link to clipboard
Copied
$.os
if ($.os.charAt (0) == 'W') {
alert("windows");
} else if ($.os.charAt (0) == 'M'){
alert("mac");
} else {
alert("whatever :-)");
}
Copy link to clipboard
Copied
Hi Pedro,
I'm afraid I was asking about MAC Address, which is the unique ID of Network Interfaces 😉
(something like e4:ce:8f:5b:a7:fc)
Davide
Copy link to clipboard
Copied
Here I can't test it, but does any of this get it some where?
$.writeln("ALLUSERSPROFILE == "+ $.getenv("ALLUSERSPROFILE"));
$.writeln("APPDATA == "+ $.getenv("APPDATA"));
$.writeln("CommonProgramFiles == "+ $.getenv("CommonProgramFiles"));
$.writeln("COMPUTERNAME == "+ $.getenv("COMPUTERNAME"));
$.writeln("ComSpec == "+ $.getenv("ComSpec"));
$.writeln("HOMEDRIVE == "+ $.getenv("HOMEDRIVE"));
$.writeln("HOMEPATH == "+ $.getenv("HOMEPATH"));
$.writeln("LOGONSERVER == "+ $.getenv("LOGONSERVER"));
$.writeln("NUMBER_OF_PROCESSORS == "+ $.getenv("NUMBER_OF_PROCESSORS"));
$.writeln("OS == "+ $.getenv("OS"));
$.writeln("Os2LibPath == "+ $.getenv("Os2LibPath"));
$.writeln("Path == "+ $.getenv("Path"));
$.writeln("PATHEXT == "+ $.getenv("PATHEXT"));
$.writeln("PROCESSOR_ARCHITECTURE == "+ $.getenv("PROCESSOR_ARCHITECTURE"));
$.writeln("PROCESSOR_IDENTIFIER == "+ $.getenv("PROCESSOR_IDENTIFIER"));
$.writeln("PROCESSOR_LEVEL == "+ $.getenv("PROCESSOR_LEVEL"));
$.writeln("PROCESSOR_REVISION == "+ $.getenv("PROCESSOR_REVISION"));
$.writeln("ProgramFiles == "+ $.getenv("ProgramFiles"));
$.writeln("SystemDrive == "+ $.getenv("SystemDrive"));
$.writeln("SystemRoot == "+ $.getenv("SystemRoot"));
$.writeln("TEMP == "+ $.getenv("TEMP"));
$.writeln("TMP == "+ $.getenv("TMP"));
$.writeln("USERDOMAIN == "+ $.getenv("USERDOMAIN"));
$.writeln("USERNAME == "+ $.getenv("USERNAME"));
$.writeln("USERPROFILE == "+ $.getenv("USERPROFILE"));
$.writeln("windir == "+ $.getenv("windir"));
Find more inspiration, events, and resources on the new Adobe Community
Explore Now