Hey everyone,
Thanks for reading. I know that there has to be a more efficient way to code this–I’m new and want to learn. The code is easy to understand. It explains itself better than I could.
Thanks.
else if object_name = "days" then
set dayslist to {}
set tableView to table view "alarmslist" of scroll view "alarmslist" of window "main"
set selected_Segments to {}
repeat with i from 0 to 6
call method "isSelectedForSegment:" of (control "days" of tab view item "tabs_date" of tab view "tabs" of window "main") with parameter i
if result is 1 then set end of selected_Segments to i
end repeat
my update_status(selected_Segments)
set selectedday to selected_Segments as Unicode text
my update_status(selectedday)
if selected_Segments contains 0 then
set mon of activedays to true
copy "Monday" to end of dayslist
end if
if selected_Segments contains 1 then
set tues of activedays to true
copy "Tuesday" to end of dayslist
end if
if selected_Segments contains 2 then
set wed of activedays to true
copy "Wednesday" to end of dayslist
end if
if selected_Segments contains 3 then
set thurs of activedays to true
copy "Thursday" to end of dayslist
end if
if selected_Segments contains 4 then
set fri of activedays to true
copy "Friday" to end of dayslist
end if
if selected_Segments contains 5 then
set sat of activedays to true
copy "Saturday" to end of dayslist
end if
if selected_Segments contains 6 then
set sun of activedays to true
copy "Sunday" to end of dayslist
end if
if dayslist is not equal to {} then
set content of data cell 3 of (selected data row of tableView) to true
else
set content of data cell 3 of (selected data row of tableView) to false
end if
set theDayut to weekday of (current date) as Unicode text
set theDayAsDay to (current date) + 1 * days
set theDayAsDay to weekday of theDayAsDay as Unicode text
my update_status(theDayAsDay)
if dayslist contains theDayut then
set displayday to "Today at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
else if dayslist contains theDayAsDay then
set displayday to "Tomorrow at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
else if dayslist contains "Monday" then
set displayday to "Monday at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
else if dayslist contains "Tuesday" then
set displayday to "Tuesday at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
else if dayslist contains "Wednesday" then
set displayday to "Wednesday at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
else if dayslist contains "Thursday" then
set displayday to "Thursday at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
else if dayslist contains "Friday" then
set displayday to "Friday at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
else if dayslist contains "Saturday" then
set displayday to "Saturday at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
else if dayslist contains "Sunday" then
set displayday to "Sunday at "
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
else if dayslist = {} then
set displayday to "No Date Selected! "
set content of data cell 3 of (selected data row of tableView) to false
set contents of data cell 2 of (selected data row of tableView) to aname of alarm1 & "
" & displayday & atime of alarm1
return
end if
end if
end clicked