Title: Scripting Help needed
Hello,

Earlier, I posted, asking for help finding or writing a script to archive messages into subfolders. I have decided (based on emails from Glenn Austin and Allan Watson) that I am capable of learning to do this myself.

So far, I am understanding a little bit of what is going on. However, I am confused by trying to build a date from a string. If I stick in a literal string, it works. If I build the string and try to construct the date from that, I get the following error message:

Microsoft Entourage got an error: Can't get date "1/1/1999".

Here is the relevant text. The dialog of datestartText shows correctly. I get the error before I get the dialog with the constructed date.

        set theYear to 1999 -- Year BEFORE we want to start
        repeat with i from 0 to 59 -- Allow for ten year range
            set theMonth to (i mod 12) + 1
            --set datestart to date ((theMonth as text) & "/1/" & (theYear as text))
            --set datestart to date "1/1/1999"
            set datestartText to (theMonth as text) & "/1/" & (theYear as text)
            display dialog "datestartText: " & datestartText
            set datestart to date datestartText
            display dialog "datestart: " & (datestart as text)
            if datestart > (current date) then exit repeat
            if theMonth = 12 then set {theYear, theMonth} to {theYear + 1, 1}
            set dateend to (date (((theMonth + 1) as text) & "/1/" & (theYear as text))) - (1 * days)
        end repeat

Any ideas and suggestions would be appreciated.

Thanks,
Ken Scott

--
<><      Ken Scott   [EMAIL PROTECTED]   http://www.pcisys.net/~kscott

                This is the day that the Lord has made;
                Let us rejoice and be glad in it          -- Psalm 118:24

Reply via email to