Craig,
Well, it seems I’m close, but no cigar yet. Below is my current script, below that, the result of the script. FixDate() has the correct info to begin to work with, but the script can’t continue for what I suspect is, a simple reason that is escaping me.
to FixDate(b)
set new_Date to {}
repeat with c from 1 to 2
if (b's word c) < 10 then
set end of new_Date to ("0" & (b's word c) & "/")
else
set end of new_Date to ((b's word c) & "/")
end if
end repeat
set end of new_Date to "20" & (b's word 3)
return (new_Date as string)
end FixDate
on sortEvents(a, l, r)
script o
property p : a
end script
using terms from application "Palm Desktop"
repeat with i from l + 1 to r
set thisEvent to o's p's item i
set thisTime to thisEvent's start time
repeat with j from i to l by -1
if (j > l) and (thisTime comes before o's p's item (j - 1)'s start time) then
set o's p's item j to o's p's item (j - 1)
else
set o's p's item j to thisEvent
exit repeat
end if
end repeat
end repeat
end using terms from
end sortEvents
on monthRange(m, y)
tell {(date (m & " 1 " & y)) - 1}
set end to beginning + 32 * days + 1
set end's day to 1
it
end tell
end monthRange
set theYear to text returned of (display dialog "Please enter a year:" default answer (current date)'s year)
tell (choose from list {"January", "February", "March", "April", "May", "June", "July", "August", ¬
"September", "October", "November", "December"} with prompt "Please choose a month:")
if it is false then error number -128
set theMonth to item 1
end tell
tell application "TextEdit"
activate
if not (exists document 1) then
make new document at beginning with properties {name:"NewGigs"}
end if
end tell
set {preDate, postDate} to monthRange(theMonth, theYear)
tell application "Palm Desktop"
set myEvents to properties of events whose start time > preDate and start time < postDate and title contains "gig"
my sortEvents(myEvents, 1, count myEvents)
repeat with i in myEvents
set gigName to title of i
set beginTime to short date string of (start time of i)
set endTime to short date string of (end time of i)
set myHour to time string of start time of i
set myEndHour to time string of end time of i
set start_char to 1
set end_char to length of myHour
set all_chars to (characters of myHour)
set end_char to -6
try
set myTime to text start_char thru end_char of myHour
set myEndtiime to text start_char thru end_char of myEndHour
end try
set a to (start time of i)
FixDate(a's short date string)
set myStuff to {new_Date & " " & " - " & " " & myTime & ", " & new_Date & " " & " - " & " " & myEndTime & " - " & gigName} as string
tell application "TextEdit"
activate
set last paragraph of document 1 to myStuff & return & return
end tell
end repeat
tell application "TextEdit"
activate
end tell
end tell
tell current application
current date
date "Friday, January 26, 2007 10:41:22 AM"
display dialog "Please enter a year:" default answer 2007
{text returned:"2007", button returned:"OK"}
choose from list {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} with prompt "Please choose a month:"
{"February"}
end tell
tell application "TextEdit"
activate
exists document 1
true
end tell
tell application "Palm Desktop"
get properties of every event whose start time > date "Wednesday, January 31, 2007 11:59:59 PM" and start time < date "Thursday, March 1, 2007 12:00:0 AM" and title contains "gig"
{{title:"What's Cookin gig @ Dazzle", start time:date "Monday, February 12, 2007 7:00:0 PM", end time:date "Monday, February 12, 2007 10:00:0 PM", duration:10800, all day event:false, alarm:missing value, primary category:category id 11, secondary category:missing value, private:false, name:"What's Cookin gig @ Dazzle (Feb 12)", class:event, id:41}, {title:"Keith Oxman gig in Vail", start time:date "Sunday, February 11, 2007 6:00:0 PM", end time:date "Sunday, February 11, 2007 10:00:0 PM", duration:14400, all day event:false, alarm:missing value, primary category:category id 11, secondary category:missing value, private:false, name:"Keith Oxman gig in Vail (Feb 11)", class:event, id:161}, {title:"Nelson Rangell gig at Brio (old Sambuca)", start time:date "Friday, February 23, 2007 8:00:0 PM", end time:date "Friday, February 23, 2007 11:59:0 PM", duration:14340, all day event:false, alarm:missing value, primary category:category id 11, secondary category:missing value, private:false, name:"Nelson Rangell gig at Brio (old Sambuca) (Feb 23)", class:event, id:167}, {title:"Margie Mauldin gig at her house", start time:date "Saturday, February 17, 2007 7:00:0 PM", end time:date "Saturday, February 17, 2007 10:00:0 PM", duration:10800, all day event:false, alarm:missing value, primary category:category id 11, secondary category:missing value, private:false, name:"Margie Mauldin gig at her house (Feb 17)", class:event, id:181}, {title:"Dave Hanson gig at Mad Russian Golf Club, Milliken, CO", start time:date "Friday, February 16, 2007 7:00:0 PM", end time:date "Friday, February 16, 2007 10:00:0 PM", duration:10800, all day event:false, alarm:missing value, primary category:category id 11, secondary category:missing value, private:false, name:"Dave Hanson gig at Mad Russian Golf Club, Milliken, CO (Feb 16)", class:event, id:326}, {title:"Pernell Steen gig at The Walnut Foundery", start time:date "Thursday, February 8, 2007 6:00:0 PM", end time:date "Thursday, February 8, 2007 8:00:0 PM", duration:7200, all day event:false, alarm:missing value, primary category:category id 11, secondary category:missing value, private:false, name:"Pernell Steen gig at The Walnut Foundery (Feb 8)", class:event, id:994}, {title:"Pernell Steen gig @ The Walnut Foundary", start time:date "Thursday, February 22, 2007 6:00:0 PM", end time:date "Thursday, February 22, 2007 9:00:0 PM", duration:10800, all day event:false, alarm:900, primary category:category id 11, secondary category:missing value, private:false, name:"Pernell Steen gig @ The Walnut Foundary (Feb 22)", class:event, id:1027}}
FixDate("2/8/07")
"Palm Desktop got an error: Can't continue FixDate."
Is it the placement of your code in my script, or something else?
Todd