Getting OSX Computer Name.......HELP

Hi,
I’m pretty new at AppleScript. I was hoping to get some help on trying to get a 10X MAC’s copmuter name or Rendezvous Name. I have tried using the GUI scriping but have not managed to get it working,
If anyone has an idea of doing this, I’d appreciate it.

Thanks

This isn’t my code but it seems to work well. I’m sorry that I don’t recall who provided it (maybe Greggo??). :slight_smile:

-- Get Rendezvous Name --
set rendezvousName to do shell script "echo $HOSTNAME"
display dialog "Rendezvous Name: " & rendezvousName

-- Get Computer Name --
set the_host to do shell script "grep APPLETALK_HOSTNAME /etc/hostconfig"
try
	set old_delims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "="
	set the_name to the second text item of the_host
	set AppleScript's text item delimiters to old_delims
on error
	set AppleScript's text item delimiters to old_delims
end try
display dialog "Computer Name: " & the_name

Rob,
Thanks for the quick response. The Rendezvous name works perfect. when I run the computer name script, I get an execution error type 1. Would you know what this is ?

I’m not sure why it might be failing. Do you get the error with just this much of the script?

set the_host to do shell script “grep APPLETALK_HOSTNAME /etc/hostconfig”

Rob,
Yes. Just the
set the_host to do shell script “grep APPLETALK_HOSTNAME /etc/hostconfig”

part of the script.

What do you get when you run this?

set x to path to startup disk as text

tell application "Finder"
	display dialog (exists file (x & "private:etc:hostconfig"))
end tell

Rob,
It’s false.
Morris

I wonder if you don’t have hostconfig. Maybe it’s part of the Dev Tools. I’m not sure and I don’t know what else to suggest. :confused:

Thanks for your help Rob. If I come up with something that works, I’ll definately post it

This script will return the Rendevous name…

do shell script "hostname"