Copy External IPv4 Address, Then, Paste It Into Notes

No.

On the home Mac, the script reveals an incorrect lanIP address.

169.254.47.13 instead of 10.0.0.132

Can you post the output of my script in post #15 run on the Mac it is erroneously reporting the wrong IP?

2025-03-16 19:10:35, Kurt Todoroff’s Mac Studio Home 2022, External-IP:71.197.19.245, Lan-IP:inactive, Wifi-IP:10.0.0.22

Wrong script…

Try this

set the clipboard to (do shell script "networksetup -listnetworkserviceorder")

An asterisk (*) denotes that a network service is disabled.
(1) USB 10/100/1000 LAN
(Hardware Port: USB 10/100/1000 LAN, Device: en15)

(2) Wi-Fi
(Hardware Port: Wi-Fi, Device: en1)

(3) Studio Display
(Hardware Port: Studio Display, Device: en6)

(4) Thunderbolt Bridge
(Hardware Port: Thunderbolt Bridge, Device: bridge0)

(5) iPhone USB
(Hardware Port: iPhone USB, Device: en14)

I don’t know why it’s not working.

It seems to work on my Mac

try posting the output from this

set net to "en6"
set the clipboard to do shell script ("ifconfig " & net)

en6: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=404<VLAN_MTU,CHANNEL_IO>
ether da:e1:fd:fd:cc:fd
inet6 fe80::d8e1:fdff:fefd:ccfd%en6 prefixlen 64 scopeid 0x11
inet 169.254.50.106 netmask 0xffff0000 broadcast 169.254.255.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active

No where in the above output is the IP “10.0.0.132”
Nothing seems to be wrong with my script. Are you sure your not mistaken about the correct IP?

Robert,

My reply number 18 contains IP address as per System Settings —> Network —> USB 10/100/1000 LAN displays 10.0.0.132.

Just now, I opened System Settings and reverified this.

Additionally, I use 10.0.0.132 for VNC.

Do you think that the Anker Adapter is the cause of this problem?

Kurt

You told me that en6 was from “Studio Display”

USB 10/100/100 is en15

Robert,

The Anker Adapter is connected to the Mac Studio en15 and is assigned 10.0.0.132.

The Studio Display is connected to the Mac Studio en6 and is assigned 169.254.50.106.

I checked System Information → Network to check the assigned IP addresses, just now.

I checked my previous replies to you. I did indeed post that the home Mac Studio uses en6 for Ethernet. This was an error. I don’t know why I typed this, when System Information clearly reveals that the home Mac Studio uses en15 for Ethernet.

I apologize, sincerely, that my inattentiveness and error frustrated your efforts. You have created a great AppleScript, which has already benefitted me.

Kurt

OK, here is a newer version of ‘getNET()’ method…

on getNet()
	local tid, netReport, netName, ans, flag
	set netReport to rest of paragraphs of (do shell script "networksetup -listnetworkserviceorder")
	set tid to text item delimiters
	set text item delimiters to return
	set netReport to netReport as text
	set text item delimiters to return & return
	set netReport to text items of netReport
	set text item delimiters to {space, return}
	set ans to {}
	set flag to true
	repeat with anItem in netReport
		set netName to text item 2 of anItem
		if netName = "Wi-fi" then
			set ans to ans & {wifi:last word of anItem}
		else if netName is in {"Studio", "Ethernet", "USB"} then
			if flag then
				set ans to ans & {ethernet:last word of anItem}
				set flag to false
			end if
		end if
	end repeat
	set text item delimiters to tid
	return ans
end getNet

Robert,

I have run the script multiple times on both Macs. All seems well, and, I am pleased with it.

To reiterate, this is a fine piece of work.

Again, my apology for my error.

Regards,

Kurt