Help converting old iCal script to python
Posted: Sun Nov 08, 2020 1:10 pm
I have an old AppleScript that I used to check my iCal for my work schedule using icalbuddy. The script then modifies four different variables based on what is returned. I put this together ages ago from some old examples I had seen here on the forum. I found one or two new python scripts that I might be able to modify but they are much more involved than this old script is. Problem is, I cant figure out how to put this in Python as my coding skills are about 1-2 levels above copy paste at this time of my life. Any help would be greatly appreciated. Thanks.
- Code: Select all
set LaString to (do shell script "/usr/local/bin/icalbuddy -nc -ic Work eventsToday")
if LaString contains "Day Work" then
set value of variable "DayWork" to "true"
else
set value of variable "DayWork" to "false"
end if
if LaString contains "Night Work" then
set value of variable "NightWork" to "true"
else
set value of variable "NightWork" to "false"
end if
if LaString contains "OFF" then
set value of variable "Off" to "true"
else
set value of variable "Off" to "false"
end if
if LaString contains "VAC" then
set value of variable "Vac" to "true"
else
set value of variable "Vac" to "false"
end if