Skip to main content
dublove
Legend
Jun 24, 2025 2:31 PM UTC
Answered

Is there any way to read my machine code?

Do I want to get my machine .
Can a script in InDesign do it?

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
Jun 25, 2025 7:18 AM UTC

Here's an example (for Windows only) of getting to computer hardware from InDesign — network adapter Name/MAC/Speed script — by calling VBScript from JavaScript.

8 replies

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
Jun 25, 2025 7:18 AM UTC

Here's an example (for Windows only) of getting to computer hardware from InDesign — network adapter Name/MAC/Speed script — by calling VBScript from JavaScript.

Translate
dublove
dubloveAuthor
Legend
Jun 25, 2025 10:22 AM UTC

Hi Kasyan Servetsky

Thank you very much.
This one is worth referring to.

 

Translate
Community Expert
Jun 24, 2025 3:03 PM UTC

I am not sure what is machine code that you are referring to. However, you can try to use the getenv method which can get value of a environment variable. So if you can find which environment variable holds this machine code you can use the code like following

$.getenv(/*environment variable name*/)

-Manan

Translate
-Manan
dublove
dubloveAuthor
Legend
Jun 24, 2025 3:10 PM UTC

Hi Manan Joshi

Can you be more specific?

I'm a little confused.

 

Perhaps it's okay to have access to CPU or Motherboard information.

Found this one, but it seems to have a lot of errors.

// 生成唯一ID的函数(Functions to generate unique IDs)
function generateUniqueId() {
    return 'xxxxxxxx-xxxx-4xxxyxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
}

// 检查LocalStorage中是否已有唯一ID(Check if there is already a unique ID in LocalStorage)
if (!localStorage.getItem('uniqueId')) {
    const uniqueId = generateUniqueId();
    localStorage.setItem('uniqueId', uniqueId);
    console.log('Newly generated unique ID:', uniqueId);
} else {
    console.log('Existing Unique ID:', localStorage.getItem('uniqueId'));
}

 

Translate
Community Expert
Jun 25, 2025 5:40 AM UTC

What I meant is that the method I listed can read the environment variable. So if the information that you want is or can be set in an environment variable you can use that method to read it. The code you listed seems to be a CEP extension code so that won't work in jsx file. Another option is to call up Applescript/VBScript from jsx. Applescript/VBScript can pull up the information using OS level functions

-Manan

Translate
-Manan