| 
 | 
 
 
发表于 2025-4-22 16:43:59
|
显示全部楼层
 
 
 
 本帖最后由 xieeyawen 于 2025-4-25 17:24 编辑  
 
/* 取的MAC&ip4 address Function 
 
*/ 
axlCmdRegister("getMacIp" 'getMacIp ?cmdType "generl") 
procedure( getMacIp() 
prog((p a ln macid ip ipid) 
    system("ipconfig /all > ipdata.txt") 
    p = axlDMOpenFile("TEMP" "ipdata.txt", "r") ;从读ipdata.txt这个输入端口获得里面的字符串 
                while(gets(ln, p)  
                        when(index(ln, "\316\357\300\355\265\330\326\267") || index(ln, "Physical Address" )  
                        macid = car(last(parseString(ln, ": \n"))) 
                            );endwhen 
                            );endwhile 
                while(gets(ip, p)  
                        when(index(ip, "IPv4 \265\330\326\267") || index(ip, "IPv4 Address" )  
                                a=parseString(ip, ": ( ) \n")  
                                ipid = nth((length(a)-2) a) 
                                        );endwhen 
                            );endwhile 
                axlDMClose(p);必须关掉端口才能输出,不关掉端口就相当于txt文件是空文件 
                deleteFile("./ipdata.txt") 
                println(macid) 
                println(ipid) 
    ); end prog 
); end procedure 
 |   
 
 
 
 |