It is currently March 28th, 2024, 3:26 pm

[Script] Path Parser

Discuss the use of Lua in Script measures.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: [Script] Path Parser

Post by StArL0rd84 »

Yeah sry about digging up this old post.
but tnx again balala, it worked.
Well, after i also added: if sOutput == 'Drive' then
return sDrive
At the bottom of the script.
I think i actually learned something about lua today. tnx
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Script] Path Parser

Post by balala »

But to be honest, if you need just the drive letter, there is no need to use a lua script. A simple String measure can do the job.
Eg, the following [MeasureDrive] measure returns the needed letter:

Code: Select all

[Variables]
Path=C:\Path\To\File.txt

[MeasureDrive]
Measure=String
String=#Path#
RegExpSubstitute=1
Substitute="^(.):.*$":"\1:"
It's much more simpler and easier to use.
Post Reply