• 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: Getting a folder based on creation date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a folder based on creation date


  • Subject: Re: Getting a folder based on creation date
  • From: Nigel Garvey <email@hidden>
  • Date: Wed, 31 Oct 2001 12:26:18 +0000

Donald Liu wrote on Tue, 30 Oct 2001 17:37:37 -0800:

>Hi all,
>
>I'm trying to write a script to get the first folder that was created
>today on OS 10.1. When I run the following script I get a Finder
>error saying that it can't make some data into the expected type.
>What is wrong with the 3rd line? It works fine in OS 9 (after
>changing the path).
>
>Any help and/or work around is appreciated.
>
>Thanks (in advance),
>-donald
>
>
>
>tell application "Finder"
> set today to (date "12:00:00 AM") of (current date)

Wow! I've never seen anything like that. A date of another date! It works
in both OS 9.0.4 and OS 8.6. The parts specified for the date on the left
of the 'of' override the equivalent parts of the date on the right. The
date on the left has to be a partial specification in the same line,
otherwise it becomes a complete date and overrides *everything* in the
date on the right. If the line contains two date specifications rather
than involving a function or a variable, it actually compiles as a
combined date:

date "17" of date "6:30"
--> Compiles (today) as: date "Wednesday, 17 October 2001 06:30:00"

Is this a bug or a feature?

By the way, it's still about five times as fast to set midnight of the
current date in the conventional way:

set today to (current date)
set today's time to 0

Or, if you want it in one line, slightly less instantaneously:

tell (current date) to set {time, today} to {0, it}

NG


  • Prev by Date: Re: Folder Actions Memory Q.
  • Next by Date: Re:Scripting Canto Cumulus 5.010
  • Previous by thread: Re: Getting a folder based on creation date
  • Next by thread: Escaped characters in variables, XML-RPC, Mac OS X
  • Index(es):
    • Date
    • Thread