Good afternoon all,
I am trying to create an Outlook calendar tracker that counts how many events are scheduled for today. The issue I’m encountering is that the event count is not reflecting the total number of events for today. I am extremely new to this, so please be patient if I am making any mistakes. I have included the code that I am currently using.
If you are able to identify where I might be going wrong, could you please point me in the right direction?
Thank you in advance for your help.
OutlookEvents.lua
OutlookEvents.ini
Log
I am trying to create an Outlook calendar tracker that counts how many events are scheduled for today. The issue I’m encountering is that the event count is not reflecting the total number of events for today. I am extremely new to this, so please be patient if I am making any mistakes. I have included the code that I am currently using.
If you are able to identify where I might be going wrong, could you please point me in the right direction?
Thank you in advance for your help.
OutlookEvents.lua
Code:
function Initialize() print("Starting calendar.lua script") ICSFile = SKIN:GetVariable("ICSFile") print("ICS File Path: " .. ICSFile) -- Log the ICS file path to verifyendfunction Update() local file = io.open(ICSFile, "r") if not file then print("Error opening ICS file: " .. ICSFile) -- Log error if the file is not found return 0 end local today = os.date("%Y%m%d") -- Today's date in YYYYMMDD format print("Today's date: " .. today) -- Log today's date local eventFound = false local inEvent = false local eventDate = "" for line in file:lines() do -- Only log critical data: event start and found date if string.find(line, "BEGIN:VEVENT") then inEvent = true elseif string.find(line, "END:VEVENT") then inEvent = false -- Check if the event's date is today or in the future if eventDate >= today then eventFound = true print("Event found for: " .. eventDate) -- Log when event is found end eventDate = "" -- Reset for next event elseif inEvent and string.find(line, "DTSTART") then -- Handle both time and date formats: Extract the date portion before the 'T' (e.g., 20250121) local date = string.match(line, "(%d%d%d%d%d%d%d%d)") -- Extract YYYYMMDD if date then eventDate = date print("Extracted event date: " .. eventDate) -- Log the extracted event date end end end file:close() -- Final check for found event if eventFound then print("Event found for today or in the future: " .. today) return 1 -- Event found else print("No event found for today or in the future.") return 0 -- No event found endend
Code:
[Rainmeter]Update=1000LuaScript=1[MeasureLua]Measure=ScriptScriptFile=OutlookEvents.luaScript=Initialize() [Variables]ICSFile="C:\Users\Blue Diamond\Documents\Rainmeter\Skins\Calendar events\calendar.ics"[MeasureTaskCount]Measure=ScriptScriptFile=OutlookEvents.luaFunction=Update[MeterTaskCount]Meter=StringText=Outlook Events Today: [MeasureTaskCount]FontSize=14FontColor=255,255,255,255
Code:
DBUG (15:16:09.739) : Today's date: 20250312DBUG (15:16:09.766) : Extracted event date: 20250121DBUG (15:16:09.784) : Extracted event date: 20250121DBUG (15:16:09.801) : Extracted event date: 20250124DBUG (15:16:09.818) : Extracted event date: 20250312DBUG (15:16:09.836) : Event found for: 20250312DBUG (15:16:09.853) : Event found for today or in the future: 20250312DBUG (15:16:09.870) : Today's date: 20250312DBUG (15:16:09.886) : Extracted event date: 20250121DBUG (15:16:09.904) : Extracted event date: 20250121DBUG (15:16:09.923) : Extracted event date: 20250124DBUG (15:16:09.940) : Extracted event date: 20250312DBUG (15:16:09.958) : Event found for: 20250312DBUG (15:16:09.974) : Event found for today or in the future: 20250312DBUG (15:16:10.520) : Today's date: 20250312DBUG (15:16:10.521) : Extracted event date: 20250121DBUG (15:16:10.537) : Extracted event date: 20250121DBUG (15:16:10.553) : Extracted event date: 20250124DBUG (15:16:10.570) : Extracted event date: 20250312DBUG (15:16:10.586) : Event found for: 20250312DBUG (15:16:10.602) : Event found for today or in the future: 20250312DBUG (15:16:10.617) : Today's date: 20250312DBUG (15:16:10.633) : Extracted event date: 20250121DBUG (15:16:10.648) : Extracted event date: 20250121DBUG (15:16:10.663) : Extracted event date: 20250124DBUG (15:16:10.678) : Extracted event date: 20250312DBUG (15:16:10.694) : Event found for: 20250312DBUG (15:16:10.709) : Event found for today or in the future: 20250312DBUG (15:16:11.519) : Today's date: 20250312DBUG (15:16:11.520) : Extracted event date: 20250121DBUG (15:16:11.544) : Extracted event date: 20250121DBUG (15:16:11.560) : Extracted event date: 20250124DBUG (15:16:11.577) : Extracted event date: 20250312DBUG (15:16:11.594) : Event found for: 20250312DBUG (15:16:11.610) : Event found for today or in the future: 20250312DBUG (15:16:11.625) : Today's date: 20250312DBUG (15:16:11.640) : Extracted event date: 20250121DBUG (15:16:11.654) : Extracted event date: 20250121DBUG (15:16:11.669) : Extracted event date: 20250124DBUG (15:16:11.683) : Extracted event date: 20250312DBUG (15:16:11.697) : Event found for: 20250312DBUG (15:16:11.711) : Event found for today or in the future: 20250312DBUG (15:16:12.521) : Today's date: 20250312DBUG (15:16:12.522) : Extracted event date: 20250121DBUG (15:16:12.544) : Extracted event date: 20250121DBUG (15:16:12.561) : Extracted event date: 20250124DBUG (15:16:12.576) : Extracted event date: 20250312DBUG (15:16:12.594) : Event found for: 20250312DBUG (15:16:12.611) : Event found for today or in the future: 20250312DBUG (15:16:12.628) : Today's date: 20250312DBUG (15:16:12.645) : Extracted event date: 20250121DBUG (15:16:12.659) : Extracted event date: 20250121DBUG (15:16:12.673) : Extracted event date: 20250124DBUG (15:16:12.690) : Extracted event date: 20250312DBUG (15:16:12.708) : Event found for: 20250312DBUG (15:16:12.724) : Event found for today or in the future: 20250312DBUG (15:16:13.514) : Today's date: 20250312DBUG (15:16:13.516) : Extracted event date: 20250121DBUG (15:16:13.550) : Extracted event date: 20250121DBUG (15:16:13.569) : Extracted event date: 20250124DBUG (15:16:13.586) : Extracted event date: 20250312DBUG (15:16:13.601) : Event found for: 20250312DBUG (15:16:13.617) : Event found for today or in the future: 20250312DBUG (15:16:13.634) : Today's date: 20250312DBUG (15:16:13.652) : Extracted event date: 20250121DBUG (15:16:13.668) : Extracted event date: 20250121DBUG (15:16:13.684) : Extracted event date: 20250124DBUG (15:16:13.699) : Extracted event date: 20250312DBUG (15:16:13.714) : Event found for: 20250312DBUG (15:16:13.729) : Event found for today or in the future: 20250312DBUG (15:16:14.517) : Today's date: 20250312DBUG (15:16:14.517) : Extracted event date: 20250121DBUG (15:16:14.540) : Extracted event date: 20250121DBUG (15:16:14.556) : Extracted event date: 20250124DBUG (15:16:14.571) : Extracted event date: 20250312DBUG (15:16:14.586) : Event found for: 20250312DBUG (15:16:14.601) : Event found for today or in the future: 20250312DBUG (15:16:14.615) : Today's date: 20250312DBUG (15:16:14.630) : Extracted event date: 20250121DBUG (15:16:14.645) : Extracted event date: 20250121DBUG (15:16:14.660) : Extracted event date: 20250124DBUG (15:16:14.676) : Extracted event date: 20250312DBUG (15:16:14.691) : Event found for: 20250312DBUG (15:16:14.706) : Event found for today or in the future: 20250312DBUG (15:16:15.513) : Today's date: 20250312DBUG (15:16:15.514) : Extracted event date: 20250121DBUG (15:16:15.545) : Extracted event date: 20250121DBUG (15:16:15.562) : Extracted event date: 20250124DBUG (15:16:15.580) : Extracted event date: 20250312DBUG (15:16:15.596) : Event found for: 20250312DBUG (15:16:15.611) : Event found for today or in the future: 20250312DBUG (15:16:15.625) : Today's date: 20250312DBUG (15:16:15.642) : Extracted event date: 20250121DBUG (15:16:15.659) : Extracted event date: 20250121DBUG (15:16:15.675) : Extracted event date: 20250124DBUG (15:16:15.689) : Extracted event date: 20250312DBUG (15:16:15.703) : Event found for: 20250312DBUG (15:16:15.720) : Event found for today or in the future: 20250312DBUG (15:16:16.523) : Today's date: 20250312DBUG (15:16:16.523) : Extracted event date: 20250121
Statistics: Posted by Welsh — Yesterday, 5:20 pm — Replies 4 — Views 63