I'm trying to display prayer times in Rainmeter using a Lua script that executes a PowerShell script to fetch prayer time data from a local API. However, despite my efforts, the prayer times are not displaying correctly in Rainmeter.
Scripts Used:
Script.lua:
GetPrayerTimes.ps1:
PrayerTime.ini:
I've tried using these scripts to display prayer times in Rainmeter, but it's not working as expected. The prayer times are not displaying correctly in Rainmeter, and I'm not sure why. If anyone has any ideas or suggestions on what I could do to solve this issue, I would greatly appreciate your help.
Scripts Used:
Script.lua:
Code:
-- Contains Lua functions to load and extract prayer times from the PowerShell scriptfunction LoadPrayerTimes() local handle = io.popen("powershell.exe -ExecutionPolicy Bypass -File 'C:/Users/Amine/Documents/Rainmeter/Skins/PrayerSkin/PrayerSkin/PrayerTime/GetPrayerTimes.ps1'") local output = handle:read("*a") handle:close() -- Parse the output and return the prayer times as an array local prayerTimes = {} for time in output:gmatch("%S+") do table.insert(prayerTimes, time) end return prayerTimesendfunction Fajr() local prayerTimes = LoadPrayerTimes() if prayerTimes then return prayerTimes[1] else return 'N/A' endend-- Other functions for Dohr, Asr, Maghreb, and Isha are similar to Fajr
Code:
# Perform an HTTP request to get prayer times$response = Invoke-RestMethod -Uri "http://127.0.0.1:5000/prayer_times" -Method Get# Check if the request succeededif ($response) { return $response} else { Write-Host "Failed to retrieve prayer times."}
Code:
[Rainmeter]Update=1000DynamicWindowSize=1[Metadata]Name=Prayer TimesAuthor=YourName[MeasureLua]Measure=ScriptScriptFile=Script.lua[MeterFajr]Meter=StringSolidColor=255,255,255Text=[&MeasureScript:Fajr()]DynamicVariables=1-- Other measures for Dohr, Asr, Maghreb, and Isha are similar to Fajr
Statistics: Posted by hackermaaan — Yesterday, 12:00 am — Replies 5 — Views 111