• 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: appending filenames daily with applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: appending filenames daily with applescript


  • Subject: Re: appending filenames daily with applescript
  • From: Pier Kuipers <email@hidden>
  • Date: Wed, 29 Nov 2000 00:44:02 +0000

Chris,

When Applescript converts a "current date" into a string it will look
something like "Wednesday, 29 November, 2000 00:05:03", which is too
long for a filename. You need to extract bits from the date, like

weekday of (current date) as string

which gives you the string "Wednesday", or

day of (current date) as string

which results in "29". What may do the trick for you is the following:

-- Replace (*OPTION L*) with the Option-L ccharacter wherever it appears.
tell application "Finder"
select file "date" of folder "FMPro database"
set name of selection to (monthnumber of (current date) as string)
& (*OPTION L*)
"." & (day of (current date) as string) & "." & (*OPTION L*)
(year of (current date) as string)
end tell

Of course you can change the full stop to whatever you like, although
I would advise against "/" if you ever want to use these filenames on
a web server.
If you want a script snippet that converts the Month name to a number
(without having to resort to scripting additions), I can dig it out
if you want it.

Cheers,

Pier.



>still having trouble with the file dating scripting -
>
>here's what i have so far:
>
>tell application "FileMaker Pro"
> do script "Duplicate File"
>end tell
>
>tell application "Finder"
> select file "date" of folder "FMPro database"
> set name of selection to the date
> string of (current date)
>end tell
>
>
>when i run this script everything works just how i want it to
>except it renames the file "Idt" and gives me a message that says:
>
>"Script Error: Finder got an error: Can't get date "Tuesday, November 28,
>2000 4:09:11 PM"
>
>so, obviuosly it is seeing the date, but the date when it is written all
>of the way out like this is simply too long to fit into a filename...
>if anyone has any ideas...
>thanks -
>chris
>_______________________________________________
>applescript-users mailing list
>email@hidden
>http://www.lists.apple.com/mailman/listinfo/applescript-users

--
---
Visual ID
A new concept in the storage
and distribution of corporate and
brand identity
http://www.visualid.com

Pier Kuipers
Visual ID
2 Whitefriars
Aungier Street
Dublin 2
Tel. +353 1 476 7059
Fax +353 1 478 1366
Mobile +353 87 294 3063
ISDN +353 1 602 0754


  • Prev by Date: Re: Scripting stuffit for .zip - TIP
  • Next by Date: downloading a url with iCab
  • Previous by thread: Re: appending filenames daily with applescript
  • Next by thread: downloading a url with iCab
  • Index(es):
    • Date
    • Thread