Posts RSS Comments RSS 48 Posts and 155 Comments till now

Get the name of the computer in Tiger (10.4)

In certain AppleScripts you’ll find you need to get the name of the computer you’re currently on. Usually you need this for things like writing to logs, etc. Here’s how to do it in Tiger:

[codesyntax lang=”applescript” lines=”no”]set theName to the computer name of the (system info)[/codesyntax]

This sets the variable “theName” to the name of your computer from the Sharing preference panel

Here’s an example. Paste the text below in Script Editor and run it.

[codesyntax lang=”applescript” lines=”no”]set theName to the computer name of the (system info)
display dialog “My computer’s name is ” & theName[/codesyntax]

Comments are closed.