It is currently March 28th, 2024, 6:05 pm

Text filter

Get help with creating, editing & fixing problems with skins
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: Text filter

Post by death.crafter »

Yincognito wrote: August 19th, 2021, 6:46 pm Indeed - learning a language (whether it's Rainmeter's INI syntax or Lua) just from answers to specific questions would be a first though. I'd be like :jawdrop if you can show me an "apprentice" that managed that. Maybe your friend Jax? :???:

For me, it took a couple of days with lots of tabs open in my browser to say I can reasonably (according to my high expectation self-review) do things in Lua. In Rainmeter, though easier, it took longer and I still discover new things day by day...
That was not my point. My point was if he wants to know how things work. May it be Rainmeter or anything, you have to analyze it anyway.
Not being rude but don't pull in other people into it.
Yincognito wrote: August 19th, 2021, 6:46 pm I don't think you'd absolutely have to do that. In a scroling scenario, you could create just enough meters (say 10 for 5 contacts in this mini skin code) and measures (15 for the same thing) for the visible part , then dynamically change them on scroll instead of selectively hiding them or whatever. I use similar approaches in my skins to reduce code to a fraction of what it originally would be (example, no other meaning involved: jsmorley's include files for 15 days of weather mean roughly 8000 lines of code for the measures, in just his largest include file; my measures don't even take 1000, and that includes [Variables] and other minor sections). Sure, this works the easier for a single scrolling item, but I have no doubt it can be done for multiple items as well. Basically, it's only the visible part that needs measures/meters in a skin. Dynamically handling things in skins is underrated, IMHO.
I can't think how will you scroll when searching, but it's you, so I wouldn't even bet 5 cents on it's impossibility :rofl:
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text filter

Post by Yincognito »

death.crafter wrote: August 19th, 2021, 10:46 pmThat was not my point. My point was if he wants to know how things work. May it be Rainmeter or anything, you have to analyze it anyway.
True. I have no idea how you expect someone who barely analyzed Rainmeter to do it for Lua though, it's like learning to run before you walk, but if you say so - I could be wrong... :confused: Oh, and no need to be protective, I actually meant it in a positive way, regarding the 'other people'. ;-)
death.crafter wrote: August 19th, 2021, 10:46 pmI can't think how will you scroll when searching, but it's you, so I wouldn't even bet 5 cents on it's impossibility :rofl:
Good point. :thumbup: I guess:

- aggregating all contact variables in a #CRLF# separated list like:

Code: Select all

fun
fantastic
great
fanbase
fans
glorious
really
bafana bafana
- eliminating everything that is not a match ((?siU).*(\N*fan\N*\R|$) to \1 for the match fan used here):

Code: Select all

fantastic
fanbase
fans
bafana bafana
- then navigating through the matches using regex quantifiers in something like (?siU)^(?:\N*fan\N*\R){3}(\N*fan\N*\R).*$ to \1 in a measure that takes the matches above as its String option
- would make it possible to scroll through the matches by simply incrementing the said quantifier while updating the above measure and using it as the String value of the indexed "scrolling" measures that are displayed in the "scrolling" meters

Obviously, things would have to switch from the "normal" way of using dynamic variables to scroll through all contacts to the above way of using dynamic quantifiers in a string to scroll through the matched contacts, probably in the CommandN option(s) of the InputText measure.

Or something like that, anyway. :???:
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: Text filter

Post by death.crafter »

Yincognito wrote: August 20th, 2021, 12:51 am True. I have no idea how you expect someone who barely analyzed Rainmeter to do it for Lua though, it's like learning to run before you walk, but if you say so - I could be wrong... :confused: Oh, and no need to be protective, I actually meant it in a positive way, regarding the 'other people'. ;-)
I don't expect him to. If he wants to learn, he can start from scratch. I just gave him a way. 6 months ago I don't know a thing about lua, and 5 months ago I made a visualizer. So I won't say it's easy but it ain't hard.
Yincognito wrote: August 20th, 2021, 12:51 am Good point. :thumbup: I guess:

- aggregating all contact variables in a #CRLF# separated list like:

Code: Select all

fun
fantastic
great
fanbase
fans
glorious
really
bafana bafana
- eliminating everything that is not a match ((?siU).*(\N*fan\N*\R|$) to \1 for the match fan used here):

Code: Select all

fantastic
fanbase
fans
bafana bafana
- then navigating through the matches using regex quantifiers in something like (?siU)^(?:\N*fan\N*\R){3}(\N*fan\N*\R).*$ to \1 in a measure that takes the matches above as its String option
- would make it possible to scroll through the matches by simply incrementing the said quantifier while updating the above measure and using it as the String value of the indexed "scrolling" measures that are displayed in the "scrolling" meters

Obviously, things would have to switch from the "normal" way of using dynamic variables to scroll through all contacts to the above way of using dynamic quantifiers in a string to scroll through the matched contacts, probably in the CommandN option(s) of the InputText measure.

Or something like that, anyway. :???:
Another thing I have learnt is that never say impossible where Yincognito is present.

But still I would say it will get as crooked as lua to get the matches, then get the indexes that the matching names have to retrieve other properties, etc etc.

Though I would simply not use regex to do something that is not meant be done with regex, especially when handling data, unless there is no other way. That's just me. ;-)
aetasoul
Posts: 11
Joined: August 7th, 2021, 6:49 am

Re: Text filter

Post by aetasoul »

It helped for sure this time, but even though you did explain how it works, I'm not sure the OP learned something out of it in order to be able to do it on his own next time, whether it's in Lua or native Rainmeter code, considering it's his 5th post here and he's most likely still a beginner. :confused:
I'll surprise you :great:
For this skin, based on your own code (and yes, you were correct with your unanswered question of "There is something else to work with strings?", as that is the key; it's called IfMatch - the IfCondition equivalent, but for strings):
Thank you that is good to know
And yes, this can have scrolling as well, with similar addition to death.crafter's implementation. This can search both contact "names" and "numbers", since it merges them in [measureContact...] measures, then uses IfMatch to test whether the contents of [measureInput] (regular expression escaped using the :EscapeRegExp parameter) is found in the previously merged string.
Thank you for the sample code and the explanation, I think (for the future skins) I'll use most of the times a lua solution. Rainmeter has a good language, but it's cofused (for me) and there is too much to copy-paste and edit just some field. To make the skin I made python script to create the base skin and generate dinamically the fields. About the death.crafter skin, I made a python script that take values from excel sheet and create the Contacts.inc file with all the names and numbers inside :thumbup:
Here's a base converter I wrote some time ago, for DEC to any base up to base 36. Maybe you can use it as a "base" (see what I just did here? :D ) to add the reverse:
Thank you for the help, I think I'll made two version of the convert, one using lua and the other one rainmeter, just to compare and learn both.
With the death.crafter skin I finally learned how to use the rainmeter language, about the lua it's a good starting point, but I think I can learn it without problem, as I do for the other languages :)
Indeed - learning a language (whether it's Rainmeter's INI syntax or Lua) just from answers to specific questions would be a first though. I'd be like :jawdrop if you can show me an "apprentice" that managed that. Maybe your friend Jax? :???:

For me, it took a couple of days with lots of tabs open in my browser to say I can reasonably (according to my high expectation self-review) do things in Lua. In Rainmeter, though easier, it took longer and I still discover new things day by day...
This is just personal experience, I think... Actually for me is more simple to learn lua than the rainmeter ini language :great:
That was not my point. My point was if he wants to know how things work. May it be Rainmeter or anything, you have to analyze it anyway.
Correct
True. I have no idea how you expect someone who barely analyzed Rainmeter to do it for Lua though, it's like learning to run before you walk, but if you say so - I could be wrong... :confused: Oh, and no need to be protective, I actually meant it in a positive way, regarding the 'other people'. ;-)
I think this is personal, it also depends on the experience one has in programming. A programmer will certainly have easier learning than a person who has just started using a language. In my specific case, I program in other languages, and I have no particular difficulties in learning lua, I will certainly not become the master of lua programmers, but I will be able to manage what I have to do and I will be able to help others. :thumbup:
I don't expect him to. If he wants to learn, he can start from scratch. I just gave him a way. 6 months ago I don't know a thing about lua, and 5 months ago I made a visualizer. So I won't say it's easy but it ain't hard.
I used your skin, but I have already changed it to only handle names and phone numbers. Now selecting a line, through lua, I send a command to dial the phone number directly on the fixed phone at my desk (Using a software specifically called "desktop dialing")

Thank you both for your help anyway :)
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text filter

Post by Yincognito »

death.crafter wrote: August 20th, 2021, 1:55 am I don't expect him to. If he wants to learn, he can start from scratch. I just gave him a way. 6 months ago I don't know a thing about lua, and 5 months ago I made a visualizer. So I won't say it's easy but it ain't hard.



Another thing I have learnt is that never say impossible where Yincognito is present.

But still I would say it will get as crooked as lua to get the matches, then get the indexes that the matching names have to retrieve other properties, etc etc.

Though I would simply not use regex to do something that is not meant be done with regex, especially when handling data, unless there is no other way. That's just me. ;-)
Possibly. Well, we work with what we have, while having various preferences for one tool or another. That's perfectly fine if it gets the job done. ;-)
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text filter

Post by Yincognito »

aetasoul wrote: August 20th, 2021, 8:41 am I'll surprise you :great:



Thank you that is good to know



Thank you for the sample code and the explanation, I think (for the future skins) I'll use most of the times a lua solution. Rainmeter has a good language, but it's cofused (for me) and there is too much to copy-paste and edit just some field. To make the skin I made python script to create the base skin and generate dinamically the fields. About the death.crafter skin, I made a python script that take values from excel sheet and create the Contacts.inc file with all the names and numbers inside :thumbup:



Thank you for the help, I think I'll made two version of the convert, one using lua and the other one rainmeter, just to compare and learn both.
With the death.crafter skin I finally learned how to use the rainmeter language, about the lua it's a good starting point, but I think I can learn it without problem, as I do for the other languages :)



This is just personal experience, I think... Actually for me is more simple to learn lua than the rainmeter ini language :great:



Correct



I think this is personal, it also depends on the experience one has in programming. A programmer will certainly have easier learning than a person who has just started using a language. In my specific case, I program in other languages, and I have no particular difficulties in learning lua, I will certainly not become the master of lua programmers, but I will be able to manage what I have to do and I will be able to help others. :thumbup:



I used your skin, but I have already changed it to only handle names and phone numbers. Now selecting a line, through lua, I send a command to dial the phone number directly on the fixed phone at my desk (Using a software specifically called "desktop dialing")

Thank you both for your help anyway :)
Ah, well, if you already have experience with other programming languages, you'd have no problem with Lua indeed, and probably will get the ins and outs of Rainmeter really quick. I didn't know that, although to be fair, there were signs that you know more in your code (e.g. 0 mistakes) that suggested that. I just wasn't sure, hence my generalized statements earlier.

That settles it, then. Nice attitude though, confident and willing to learn - looking forward to hear from you again here on the forum, and the best of luck with your other implementations. ;-)
aetasoul
Posts: 11
Joined: August 7th, 2021, 6:49 am

Re: Text filter

Post by aetasoul »

Yincognito wrote: August 20th, 2021, 9:05 am Ah, well, if you already have experience with other programming languages, you'd have no problem with Lua indeed, and probably will get the ins and outs of Rainmeter really quick. I didn't know that, although to be fair, there were signs that you know more in your code (e.g. 0 mistakes) that suggested that. I just wasn't sure, hence my generalized statements earlier.

That settles it, then. Nice attitude though, confident and willing to learn - looking forward to hear from you again here on the forum, and the best of luck with your other implementations. ;-)
Thank you :)
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: Text filter

Post by death.crafter »

aetasoul wrote: August 20th, 2021, 8:41 am
Wow, you sure took your time.

P.S. just be sure to save the inc file you are making through python in utf-8 as lua in Rainmeter(or may be in general) can't handle unicode(utf-16).
aetasoul
Posts: 11
Joined: August 7th, 2021, 6:49 am

Re: Text filter

Post by aetasoul »

death.crafter wrote: August 20th, 2021, 10:47 am Wow, you sure took your time.

P.S. just be sure to save the inc file you are making through python in utf-8 as lua in Rainmeter(or may be in general) can't handle unicode(utf-16).
Thank you for the suggestion :)
Post Reply