• 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: Is this legit? [POSIX]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this legit? [POSIX]


  • Subject: Re: Is this legit? [POSIX]
  • From: "Nigel Garvey" <email@hidden>
  • Date: Thu, 24 Jul 2008 14:55:54 +0100

In my message of Wed, 23 Jul 2008 16:14:55 +0100, I wrote:

>  set tzPath to POSIX path of ("/etc/localtime" as POSIX file as Unicode
>text)
>  set astid to AppleScript's text item delimiters
>  set AppleScript's text item delimiters to "zoneinfo/"
>  set tz to text item 2 of tzPath
>  set AppleScript's text item delimiters to astid
>  tz --> "Europe/London"
>
>This works for other time zones too. But is the "/etc/localtime" coercion
>trick a legitimate usage, or is it just something that happens to work in
>Tiger and Jaguar?

Thanks to Michelle, Philip, and Axel for their replies. I haven't quite
decided how to play it yet, but the suggestions have been very helpful.

Philip wrote:

>set city to (do shell script "defaults read /Library/
>Preferences/.GlobalPreferences
>com.apple.TimeZonePref.Last_Selected_City")
>words of paragraph 5 of city

This feels nice because it's a preference read. It's slightly worrying
that it depends on the information being in a certain-numbered paragraph
of the text, but it works on both my Tiger and Jaguar machines.

Axel wrote:

>As a result, I would tend to avoid any ambiguity, even at the cost of
>spawning a shell process:
>do shell script "/usr/bin/readlink /etc/localtime"
>--> "/usr/share/zoneinfo/Europe/Brussels"

A more confidence-inspiring version of my own effort and (when combined
with the rest of the script) somewhere between it and Philip's for speed.
Unfortunately, my Jaguar system doesn't recognise the "readlink" command,
but that's not the end of the world!  :)

Thanks again for your thoughts.

NG

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Is this legit? [POSIX]
      • From: Axel Luttgens <email@hidden>
    • Re: Is this legit? [POSIX]
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Is this legit? [POSIX] (From: "Nigel Garvey" <email@hidden>)

  • Prev by Date: Script Editor crashing
  • Next by Date: Re: Is this legit? [POSIX]
  • Previous by thread: Re: Is this legit? [POSIX]
  • Next by thread: Re: Is this legit? [POSIX]
  • Index(es):
    • Date
    • Thread