• 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: Re: constructing file name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: constructing file name


  • Subject: Re: Re: constructing file name
  • From: Hanaan Rosenthal <email@hidden>
  • Date: Mon, 23 Feb 2004 8:23:01 -0500
  • Organization: Custom Flow Solutions

> "Can't make February into a integer"

Yes. This is because only AppleScript that ships with Panther supports
coercion of months into numbers (July = 7, etc.)
Since you're using 10.2.8, you will need a little handler that figures out the
number of the date:

set thisMonth to month of (current date)
getMonthNumber(thisMonth)

on getMonthNumber(theMonth)
set monthsList to {January, February, March, April, May, June, July,
August, September, October, December}
repeat with thisMonthAsNumber from 1 to 12
if (get item thisMonthAsNumber of monthsList) is theMonth then
return thisMonthAsNumber
end if
end repeat
end getMonthNumber

>the final output should be one day ahead of the current date

In order to get tomorrows date, just add 'days' to current date:

-->current date = date "Monday, February 23, 2004 8:22:29 AM"
set tomorrowDate to (current date) + days
--> date "Tuesday, February 24, 2004 8:19:21 AM"

The built in global variable 'days' is an integer with the value of 86400, which
is the number of seconds in a day. Adding that to a date bumps that date by
one day.

Hanaan

>
> I ran into an error on this:
>
> "Can't make February into a integer"
>
>
> On Monday, February 23, 2004, at 12:40 AM, Graff wrote:
>
> > Just as easy, here is 1 day ahead:
> > ------------
> > set tomorrow to (current date) + 1 * days
> > -- the next line formats the date into an integer with yyyymmdd format
> > set dateInt to ((year of tomorrow) * 10000) + (((month of tomorrow) as
> > integer) * 100) + (day of tomorrow)
> > set remote_filename to "" & dateInt & "-da.csv"
> > ------------
> >
> > - Ken
> >
> > On Feb 22, 2004, at 10:33 PM, Mike Bautsch wrote:
> >
> >> This is the type of thing I thought I would have to do. The only thing
> >> I see wrong with this is the date is not fixed, it would have to be
> >> the
> >> current date of any given day plus 1 day. I made a mistake in my
> >> original post, the final output should be "20040223-da.csv" one day
> >> ahead of the current date.
> > _______________________________________________
> > applescript-users mailing list | email@hidden
> > Help/Unsubscribe/Archives:
> > http://www.lists.apple.com/mailman/listinfo/applescript-users
> > Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/
applescript-users
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: OT: AppleScript cartoon
  • Next by Date: AppleScript Replace text in item names
  • Previous by thread: Re: constructing file name
  • Next by thread: True Optional Handler Parameters (Positional)
  • Index(es):
    • Date
    • Thread