• 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
List oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

List oddity


  • Subject: List oddity
  • From: "Stockly, Ed" <email@hidden>
  • Date: Mon, 2 Aug 2010 18:56:35 -0500
  • Acceptlanguage: en-US
  • Thread-topic: List oddity

Here is a little script that creates a test string based on some dates,
using specific month abbreviations.

  I get an empty text string if I use this construct:

set weekString to {item startMonth of mnths, startDay, "‹", item endMonth of
mnths, endDay} as text

But it works with this construct:



property mnths : {"Jan.", "Feb.", "March", "April", "May", "June", "July",
"Aug.", "Sept.", "Oct.", "Nov.", "Dec."}
set rightNow to (current date)
set dayOWeek to weekday of rightNow as integer
set daysToSun to 8 - dayOWeek
set startDate to rightNow + daysToSun * days
set startMonth to month of startDate as integer
set startDay to day of startDate
set endDate to startDate + 7 * days
set endMonth to month of endDate as integer
set endDay to day of endDate
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" "}

if endMonth is not startMonth then
    set weekString to {item startMonth of mnths, startDay, "‹", item
endMonth of mnths, endDay} as text
else
    set weekString to {item startMonth of mnths, startDay, "‹", endDay} as
text
end if
display dialog weekString

if endMonth is not startMonth then
    set weekString to {item startMonth of mnths, startDay, "‹", item
endMonth of mnths, endDay}
else
    set weekString to {item startMonth of mnths, startDay, "‹", endDay}
end if
set AppleScript's text item delimiters to oldDelims
set weekString to weekString as text
display dialog weekString

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: can this be simplified?
  • Next by Date: List oddity
  • Previous by thread: Re: newbie questions
  • Next by thread: List oddity
  • Index(es):
    • Date
    • Thread