Hi
I use the below in my app to check to see if the ip listed matches one of the macs ip’s that
the app is on, if it is in the list then the app carries on, if not it will disable the menu items,
this has been working flawlessly until mavericks, the part that errors is this portion, could some one explain why this is hapening, and how to fix, or is this a possible problem on my mac, which is latest mac book pro 15"
set myCompID to (do shell script "ipconfig getifaddr en0")
error returned is
try
set my_Allow to {"00.00.00.00", "00.00.00.00", "00.00.00.00", "00.00.00.00", "00.00.00.00"}
set myCompID to (do shell script "ipconfig getifaddr en0")
if my_Allow does not contain myCompID then
TEST's orderOut:me
(current application's NSApp's mainMenu's itemWithTitle:"TEST")'s setEnabled:0 --disable menu items
AddSec's makeKeyAndOrderFront:me
end if
end try
interestingly, if I turn on the wifi, and use “en0” I get a reply showing the wifi ip, yet if I turn off the wifi and go through the LAN, I get the “non zero status” error, I have tried both “en0” & “en1” going through the LAN, both produce the same error
I used this a few years ago, the result in ipV4 is either the first found ipV4 address or «unknown»
repeat with interfaceIndex from 0 to 5
set ipV4 to do shell script ("/sbin/ifconfig en" & interfaceIndex & " | awk '/inet / {print $2}'")
if ipV4 is not in {"inet", ""} then exit repeat
set ipV4 to "«unknown»"
end repeat
Hi Stefan:
Thanks for that, your code works fine here, your different approach produces the IP required, but leaves me
still wondering why the code
do shell script "ipconfig getifaddr en0"
has stopped working properly.
Hi Shane:
I had tried that outside of Xcode (4.6.3), the same error was thrown, quite strange
just to clarify, as the “Operating Systems” drop box does not go upto 10.9
I am running Mavericks 10.9 (right uptodate) Macbook pro 15" Late 2013,
just in case this has some influence on the result I am getting.