It is currently May 25th, 2019, 2:21 pm

Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y oracion)

Post your work-in-progress and completed skins to share and discuss.
FernandoAleisy
Posts: 6
Joined: April 23rd, 2019, 3:47 am

Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y oracion)

FernandoAleisy » April 23rd, 2019, 5:34 pm

Script lua to show the text in uppercase, lowercase or sentence format in a string meter in Rainmeter.
I was carrying out a Rainmeter project and it occurred to me to create this script for my skins.
I've thought about adding more text styles, but I still can not think of cases that might be needed for the presentation of the strings.

"Script lua para mostrar el texto en mayúsculas, minúsculas o en formato de oraciones en un medidor de cuerdas en Rainmeter.
Estaba llevando a cabo un proyecto Rainmeter y se me ocurrió crear este script para mis máscaras.
He pensado en agregar más estilos de texto, pero todavía no puedo se me ha ocurrido casos que podrían ser necesarios para la presentación de los string".

this is the script in lua

Code: Select all

--Minúsculas
function min(p)
	m=string.lower ( p )
	return m
end

--Mayúsculas
function may(q)
	n=string.upper ( q )
	return n
end

--Oración
function ora(r)
	o=string.lower (string.sub (r, 2,-1))
	s=string.upper (string.sub (r, 1,1))
	return s..o
end

and for those who still do not know how to use the lua script in Rainmeter, here is the code in the .ini file.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Metadata]
Name=TeXtO
Author=FernandoAleisy
Version=0.1
License=Libre
Information=Convertir texto a minuscula, mayuscula u oracion

[Variables]
Texto=eSte TextO

[Estilo]
x=0
y=R
W=200
Padding = 5 , 5 , 5 , 5 
FontColor=255,255,255
FontFace=Lucida calligraphy
AntiAlias = 1 
StringStyle=Bold
FontSize = 10
DynamicVariables=1

[TextoOriginal]
Meter=String
MeterStyle=Estilo
SolidColor=0,0,0
Text=Original        #Texto#

[Texto]
Measure=Script
ScriptFile=Texto.lua
Disabled=1

[Minuscula]
Meter=String
MeterStyle=Estilo
SolidColor=0,200,100
Text=Minuscula    [&Texto:min('#Texto#')]

[Mayuscula]
Meter=String
MeterStyle=Estilo
SolidColor=255,100,0
Text=Mayuscula   [&Texto:may('#Texto#')]

[Oracion]
Meter=String
MeterStyle=Estilo
SolidColor=100,100,255
Text=Oracion        [&Texto:ora('#Texto#')]

[Ejemplo]
Meter=String
MeterStyle=Estilo
SolidColor=0,200,200
Text=Ejemplo:#CRLF#[&Texto:ora('fernando')] [&Texto:ora('aleisy')] [&Texto:ora('gonzalez')]
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 8208
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y orac

balala » April 23rd, 2019, 6:17 pm

FernandoAleisy wrote:
April 23rd, 2019, 5:34 pm
Script lua to show the text in uppercase, lowercase or sentence format in a string meter in Rainmeter.
Your code is for sure useful in many cases, however sometimes a much easier solution does exist: you can add a StringCase option to the String meters. It has four possible values:
  • None - the string isn't altered, it is show as it is.
  • Upper - All letters converted uppercase.
  • Lower - All letters converted lowercase.
  • Proper - The first letter of all words is converted uppercase. Here is a great difference, because using the ora function of your lua script, you get uppercase only the first letter of the whole string, while setting the StringCase to Proper sets uppercase all first letter of all words within the string.
Again, please don't misunderstand me, your code can be and is useful in many cases, I just wanted to show an (at least sometimes) usable alternative.
FernandoAleisy
Posts: 6
Joined: April 23rd, 2019, 3:47 am

Re: Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y orac

FernandoAleisy » April 23rd, 2019, 6:57 pm

Yes, you can use the StringCase, but in my case I wanted only part of the text to be modified and I could not do it with StringCase.
The StringCase modifies all the text that is shown in the meter.
thanks for your contribution. :rolmfao:
User avatar
balala
Rainmeter Sage
Posts: 8208
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y orac

balala » April 23rd, 2019, 7:02 pm

FernandoAleisy wrote:
April 23rd, 2019, 6:57 pm
The StringCase modifies all the text that is shown in the meter.
Not necessarily. You can use the Case setting of an Inline to get modified the string only partially.
FernandoAleisy
Posts: 6
Joined: April 23rd, 2019, 3:47 am

Re: Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y orac

FernandoAleisy » April 23rd, 2019, 8:03 pm

I have to study Inline
User avatar
balala
Rainmeter Sage
Posts: 8208
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y orac

balala » April 23rd, 2019, 8:20 pm

FernandoAleisy wrote:
April 23rd, 2019, 8:03 pm
I have to study Inline
Yep, it's an interesting option, added on July 31, 2015 (version 3.3.2423) to the String meters, which indeed worth to be studied a little bit.
However I don't contest the benefits of your code. In many cases it can be useful and don't be disappointed by my reply to your initial message, your code is definitely useful. Just had to add that comment.
FernandoAleisy
Posts: 6
Joined: April 23rd, 2019, 3:47 am

Re: Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y orac

FernandoAleisy » April 23rd, 2019, 10:39 pm

no problem, no disappointment, in fact I could be asking about doubts that arise about rainmeter. Of course, if it's not an inconvenience for you.
User avatar
balala
Rainmeter Sage
Posts: 8208
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Script lua for text in uppercase, lowercase and type of sentence (Scritp lua, texto en mayusculas, minusculas y orac

balala » April 24th, 2019, 5:40 am

FernandoAleisy wrote:
April 23rd, 2019, 10:39 pm
Of course, if it's not an inconvenience for you.
No, it's never. I'm happy to help whenever I have enough time and energy. Other times you have to wait for a while.