Re: New Folder with date
Re: New Folder with date
- Subject: Re: New Folder with date
- From: Charles Arthur <email@hidden>
- Date: Fri, 6 Apr 2001 14:28:56 +0100
On Thu, 5 Apr 2001 23:31:11 +0900, Stephen Wheeler (Saito)
<email@hidden> wrote:
>
I have this script which makes a folder with today's date,
>
>
tell application "Finder"
>
set aDate to current date -- today's date
>
set yy to year of aDate
>
set mm to month of aDate
>
set dd to day of aDate
>
set myFile to (yy & "/" & mm & "/" & dd) as text -- file name
>
make new folder with properties {name:myFile}
>
end tell
>
>
>
But I want to return the month as a number and not a name. Is there any
>
other way of doing this with out added this,
You can't do it directly (eg "set mm to count of month of aDate" or "number
of month of aDate" don't work).
Bill Briggs covered this in one of his columns at Maccentral at
http://maccentral.macworld.com/columns/briggs.shtml (specifically, in
http://maccentral.macworld.com/news/0006/15.briggs.shtml - I just looked at
it.)
His uses repeat loop, though perhaps there's a better way by constructing a
list of the form
set monthlist to {January: "01", February: "02",...} where you would coerce
the month part of the date to a string (careful! because "month of date" is
not a standard string) and then get the record matching that in your list.
Anyway, this is an occasional topic here - expect it's on the Google
search. (Hmm.) Try putting in all the months as your search term.
>
Also the next thing I want to do with this script is to copy a folder
>
named "db"into this newly made dated folder.
Finder dictionary:
duplicate : Duplicate one or more object(s)
duplicate reference -- the object(s) to duplicate
[to location reference] -- the new location for the object(s)
[replacing boolean] -- Specifies whether or not to replace
items in the destination that have the same name as items being duplicated
[routing suppressed boolean] -- Specifies whether or not to
autoroute items (default is false). Only applies when copying to the system
folder.
Result : reference -- to the duplicated object(s)
duplicate [path to db] to [path to new folder].
best
Charles
----------------------------
http://www.ukclimbing.com : 1000+ British crags, 350+ British climbing
walls - searchable by distance and anything else you care to think of -
with weather forecasts for every one, plus maps, articles, news and
features. Plus Britain's busiest climbing discussion boards. And there's
even a cool shop attached.