Re: Renaming Picture 1
Re: Renaming Picture 1
- Subject: Re: Renaming Picture 1
- From: "Alatorre, Michael" <email@hidden>
- Date: Tue, 22 Jan 2002 16:10:02 -0800
>
I'm new to AS.
>
>
I want to rename a file and add the date, in YY-MM-DD format. The filename
>
gets altered correctly but the date isn't added!
>
>
Here's what I wrote:-
>
>
>
tell application "Finder"
>
set the date_slug to my format_date_using(the current date, ".",
{"YY",
>
"MM", "DD"})
>
set filename to filename & " " & date_slug
>
end tell
FWIW, I scripted something similar (learning/modifying from those on this
list far more experienced than I) for renaming (plus adding "mmyy" to the
name) and copying the file to our server. Portions maybe useful for you:
tell application "Finder"
if file "Data HD:Out:ais_full.pdf" exists then
-- create naming variables based on today's date
set today to current date
set thisyear to the year of today
set thisyear to text -2 thru -1 of (thisyear as string)
set thismonth to text 1 through 3 of (the month of today as string)
set monthAbbr to "JanFebMarAprMayJunJulAugSepOctNovDec"
set monthNum to ((the offset of thismonth in monthAbbr) + 2) div 3
set monthNum to text -2 thru -1 of (("0" & (monthNum as integer)))
as text
set reportDate to monthNum & thisyear
set reportTitle to "Adult Inpatient Summary" & reportDate & ".pdf"
set reportFile to "Data HD:Out:" & reportTitle
-- rename and copy file to server
select file "Data HD:Out:ais_full.pdf"
set name of selection to reportTitle
duplicate file reportFile to folder "Medical Affairs:PDF
Library:Executive Summary:" with replacing
else
display dialog "ais_full.pdf does not exist"
end if
end tell
HTH
Michael Alatorre (
mailto:email@hidden)
EIS Liaison Analyst
Cedars-Sinai Health System (
http://www.cedars-sinai.edu/)
Medical Affairs: 310.423.6237 310.423.0448 (fax)
"...honor is a harder master than the law. It cannot compromise for less
than 100 cents on the dollar and its debts never outlaw." -- Mark Twain