Re: truncate the hostname of local computer
Re: truncate the hostname of local computer
- Subject: Re: truncate the hostname of local computer
- From: Sander Tekelenburg <email@hidden>
- Date: Fri, 10 Dec 2004 06:50:44 +0100
At 16:13 -0800 UTC, on 2004/12/09, Steve Ingram wrote:
[...]
> In a script we are using to reset the computer name I have the line:
>
> set computerNameNoChange = `/bin/hostname`
That's not AppleScript.
> This gives me a value of ghs27038.local
>
> This is close to what I want. How do I get computerNameNoChange to
> equal only the first eight characters of /bin/hostname ?
Manipulate your result. Periods happen to be word delimiters, so in this case
you can do:
set computerNameNoChange to first word of (do shell script "/bin/hostname")
(When you're not so lucky to have a word delimiter you'll need to use text
item delimiters. See the AppleScript Language Guide, at
<http://www.apple.com/applescript/resources/>.)
--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden