I’m pretty new to applescript and am trying to ask a user to return a weekday from a list. I’ve tried several ways with no luck, the script is below - can anyone show me how to do this? Also can I declare a “theDate” variable without setting it?
set theDate to current date
choose from list {¬
Monday, ¬
Tuesday, ¬
Wednesday, ¬
Thursday, ¬
Friday, ¬
Saturday, ¬
Sunday} ¬
with prompt “Select Day of Recording”
set weekday of theDate to result
I don’t think so. I’m trying to construct a variable of class type date from user input. So, I’m asking them to enter weekday, day, month, year and then trying to construct a date from that. As I then want to do some arithmetic on the date, I can’t deal with the input as strings unless I write some subroutines to handle dates represented as strings. My understanding is that Applescript provides a date class with subclasses of weekday, day, month and year. The script I gave provided options as types of the weekday class (like an enum in C i guess) rather than using “Monday”, which I guess would be taken as a string. However when I try to set the weekday of my date variable from the result I get an error.
I guess what I’m looking for is a typecast style operation that will allow the result to be returned as a weekday type?
I’m guessing that the solution given deals with the days of the weeks as a list of strings?