• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: truncate the hostname of local computer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >truncate the hostname of local computer (From: Steve Ingram <email@hidden>)

  • Prev by Date: Re: truncate the hostname of local computer
  • Next by Date: folder actions..
  • Previous by thread: Hide process --> fullscreen game
  • Next by thread: Re: truncate the hostname of local computer
  • Index(es):
    • Date
    • Thread