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

Perform functions on different IP´s

Engaged ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

Hello everyone!
Is there any way for a script to perform functions on different IPs
Type:
If this computer's IP is "192.168.0.77" then do "Function A"
If IP is different then do "Function B"
Thank you!

TOPICS
Actions and scripting

Views

652

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 1 Correct answer

People's Champ , Dec 10, 2019 Dec 10, 2019

On windows you can try

var ip = get_ip();

alert(ip);

//switch (ip)
//    {
//    }


function get_ip()
    {
    try {
        app.system("ipconfig>%TEMP%\\tmp.txt");
    
        var file = new File(Folder.temp.fsName + "\\" + "tmp.txt");
    
        file.open();
    
        var s = file.read();
    
        file.close();
    
        s = s.split("\n");
    
        var ip = null;
    
        for (var i = 0; i < s.length; i++)
            {
            if (s[i].search(/IPv4/i) >=0)
        
...

Votes

Translate

Translate
Adobe
LEGEND ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

The socket object functions in Extend Script might be able to give you that info, though I have no idea about the specifics.

 

Mylenium

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
LEGEND ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

Directly by extendscript you can't, but you can get user and computer name.

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
People's Champ ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

On windows you can try

var ip = get_ip();

alert(ip);

//switch (ip)
//    {
//    }


function get_ip()
    {
    try {
        app.system("ipconfig>%TEMP%\\tmp.txt");
    
        var file = new File(Folder.temp.fsName + "\\" + "tmp.txt");
    
        file.open();
    
        var s = file.read();
    
        file.close();
    
        s = s.split("\n");
    
        var ip = null;
    
        for (var i = 0; i < s.length; i++)
            {
            if (s[i].search(/IPv4/i) >=0)
                {
                s[i] = s[i].replace(/IPv4/i, "");

                var n = s[i].search(/\d/);
    
                if (n >= 0)
                    {
                    ip = s[i].substr(n);
                    break;
                    }
                }
    
            }    
    
        return ip;
        }    
    catch (e) { alert(e); }
    }        

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
Engaged ,
Dec 11, 2019 Dec 11, 2019

Copy link to clipboard

Copied

LATEST

Man, you very good!
It worked very well here.
Good thing we still have users like you in this community that unfortunately is no longer the same.
Thank you r-bin.

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