Newb question, I am trying to teach myself applescript and have run into an issue
Any help is appreciated
I have been trying to get this to work but it fails to do what I want.
I want to have a box come up with a choice from a list of variables. Then I want to have the choice made turned into a new variable, for this case it is desc. (That does not work it comes back as TEXT after display Dialog) I expected what was chosen ex: “choice A”. and that variable passed to the rest of the script -make new ical with the variable desc with the description from desc. If I pull out the if, then, else statement and use the aD, bD or cD variable, the tell application ical create a calendar aD with description aD part works.
set aDesc to "choice A"
set bDesc to "choice B"
set cDesc to "choice C"
set desc to string -- temp holder of value passed from above variables
choose from list {aDesc, bDesc, cDesc} with prompt "Choose A, B or C"
--display dialog result
if result = aDesc then
set aDesc to desc
else
if result = bDesc then
set bDesc to desc
else
if result = cDesc then
set cDesc to desc
end if
end if
end if
--display dialog desc
tell application "iCal"
create calendar with name desc
end tell
tell application "iCal"
tell calendar desc
set theDate to current date
make new event at end with properties {description:desc, summary:"summary", location:"Location", start date:theDate, allday event:true}
end tell
end tell