Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VOIDBattery.ini
- -----------------------------------------------------
- [Rainmeter]
- Update=2000 ; Every 10 seconds
- AccurateText=1
- DynamicWindowSize=1
- OnUpdateAction=[!CommandMeasure MeasureReadBattery "Run"]
- [Metadata]
- Name=
- Author=
- Information=
- Version=
- License=
- [Variables]
- [MeasureReadBattery]
- Measure=Plugin
- Plugin=RunCommand
- Parameter=ReadBatteryLevel.exe
- State=Hide
- [MeasureBatteryLevel]
- Measure=Script
- ScriptFile=read_file.lua
- IfCondition=(MeasureBatteryLevel >= 0) && (MeasureBatteryLevel <= 100)
- IfTrueAction=[!SetOption MeterBatteryText Text "%1%"]
- IfFalseAction=[!SetOption MeterBatteryText Text "N/A"]
- [MeterBatteryText]
- Meter=String
- MeasureName=MeasureBatteryLevel
- AntiAlias=1
- FontColor=165,224,218
- FontSize=16
- FontFace=Century Gothic
- StringAlign=Left
- NumOfDecimals=0
- AutoScale=1
- read_file.lua
- -----------------------------------------------------
- function Update()
- FilePath = "./battery_level.txt"
- -- HANDLE RELATIVE PATH OPTIONS.
- FilePath = SKIN:MakePathAbsolute(FilePath)
- -- OPEN FILE.
- local File = io.open(FilePath)
- -- HANDLE ERROR OPENING FILE.
- if not File then
- print('ReadFile: unable to open file at ' .. FilePath)
- return
- end
- -- READ FILE CONTENTS AND CLOSE.
- local Contents = File:read('*all')
- File:close()
- return Contents
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement