Ваши комментарии
I changed to this and found that the index was 2.
var myIp;
var myIpFound = false;
if (typeof IR.GetCurrentLocalIPInfo == "function") {
// [0] = WiFi [1] = LAN
var iPInfo = IR.GetCurrentLocalIPInfo();
for (var index = 0; index < iPInfo.length; index++) {
if (iPInfo[index] != null) {
IR.Log("index = " + index);
IR.Log("Name = " + iPInfo[index].Name);
IR.Log("IP = " + iPInfo[index].IP);
IR.Log("Mask = " + iPInfo[index].Mask);
IR.Log("MAC = " + iPInfo[index].MAC);
myIp = iPInfo[index].IP;
if (myIp.search("0.0.0.0") < 0 && myIp.search("169.") < 0) { // returns the position of the match.
myIp = iPInfo[0].IP // WiFi connected // WiFi is used if address searched is found
myIpFound = true;
break;
}
}
}
if (!myIpFound) {
myIp = "0.0.0.0";
}
}
else IR.Log("No IP Info.");
I did try the latest 1.1.2 and still get a 169. address returned.
I changed the code to the following. I was getting an Error by not testing for null.
if (typeof IR.GetCurrentLocalIPInfo == "function") {
// [0] = WiFi [1] = LAN
var iPInfo = IR.GetCurrentLocalIPInfo();
if (iPInfo[0] != null) {
IR.Log("WiFi Name = " + iPInfo[0].Name);
IR.Log("IP = " + iPInfo[0].IP);
IR.Log("Mask = " + iPInfo[0].Mask);
IR.Log("MAC = " + iPInfo[0].MAC);
}
if (iPInfo[1] != null) {
IR.Log("Lan Name = " + iPInfo[1].Name);
IR.Log("IP = " + iPInfo[1].IP);
IR.Log("Mask = " + iPInfo[1].Mask);
IR.Log("MAC = " + iPInfo[1].MAC);
}
}
else IR.Log("No IP Info.");
if (iPInfo[0].IP != null) {
var myIp = iPInfo[0].IP;
if (myIp.search("0.0.0.0") < 0 && myIp.search("169.") < 0) { // returns the position of the match.
myIp = iPInfo[0].IP // WiFi connected // WiFi is used if address searched is found
}
}
else if (myIp != null && iPInfo[1].IP != null) {
myIp = iPInfo[1].IP // Use Lan
} else myIp = "0.0.0.0";
It should report 192.168.10.3.
MAC: F4:8E:38:78:89:33
This used to work without any issue.
This turned out to be an issue with the text color opacity set to 0. have not had any issues since.
Last time I tested this was version 1.0.5.
If there is a method to save the Tokens when the program is exited, there should be a method to execute a command to save Tokens.
Mike
Yes I had tried it again and had not issue.
Mike
I found that using IR.Exit() will not save the tokens, but closing the App nomally will save the tokens.
I converted the program to iPad, but cannot get it to save the tokens. I have no issue with the PC saving the tokens, since I added a save button to exit and restart the app. Also is there an API call to clear the tokens so I can set the project back to default?
Сервис поддержки клиентов работает на платформе UserEcho
So I put the timer above it and added a test for the IP address and finally got it to work. Thanks
IR.SetInterval(1000, oneSecTimer);
// ***********
//////////////
var iPInfo = IR.GetCurrentLocalIPInfo();
if (iPInfo != null) {
IR.GetItem("PP_Settings").GetItem("MyIpAddressTxt").Text = "TCX9 IP: 0.0.0.0";
for (var index = 0; index < iPInfo.length; index++) {
if (iPInfo[index].IP != null) {
IR.Log("index = " + index);
IR.Log("Name = " + iPInfo[index].Name);
IR.Log("IP = " + iPInfo[index].IP);
IR.Log("Mask = " + iPInfo[index].Mask);
IR.Log("MAC = " + iPInfo[index].MAC);
var myIp = iPInfo[index].IP;
if (myIp.search("0.0.0.0") < 0 && myIp.search("169.") < 0) { // returns the position of the match.
IR.GetItem("PP_Settings").GetItem("MyIpAddressTxt").Text = "My IP: " + myIp;
IR.GetItem("PP_Settings").GetItem("MyMacAddressTxt").Text = "MAC: " + iPInfo[index].MAC;
break;
}
}
}
}
Mike