It is currently March 29th, 2024, 5:00 am

Capturing User Input?

Get help with creating, editing & fixing problems with skins
Bloodlvst
Posts: 2
Joined: April 30th, 2018, 12:09 am

Capturing User Input?

Post by Bloodlvst »

Hi there,

So I'm new to the Rainmeter game, but I have some big ambitions, and so far, I think I'm doing okay.

I've manager to create a weather skin that shows what I need. However, I'd like to be able to capture the user's input so that if I shared this with someone, they wouldn't need to edit any code. Eventually, I'd like to create a suite of skins, so I'm thinking my best way to do this would be by creating a standalone settings include file to hold each setting in a variable and calling it from each individual skin.

Where I'm getting stuck is how would I capture a user's input in say, a text box? The documentation was a little confusing for me, so maybe I'm just missing something? I'd like to be able to parse a user's text input and write other code to do whatever is required with it.

Semi-related question: For something like a skin suite with multiple skins, is it best to create a framework for highly used resources/functions?

Thanks so much for any help you can provide! :)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Capturing User Input?

Post by balala »

Bloodlvst wrote:Hi there,

So I'm new to the Rainmeter game, but I have some big ambitions, and so far, I think I'm doing okay.

I've manager to create a weather skin that shows what I need. However, I'd like to be able to capture the user's input so that if I shared this with someone, they wouldn't need to edit any code. Eventually, I'd like to create a suite of skins, so I'm thinking my best way to do this would be by creating a standalone settings include file to hold each setting in a variable and calling it from each individual skin.

Where I'm getting stuck is how would I capture a user's input in say, a text box? The documentation was a little confusing for me, so maybe I'm just missing something? I'd like to be able to parse a user's text input and write other code to do whatever is required with it.

Semi-related question: For something like a skin suite with multiple skins, is it best to create a framework for highly used resources/functions?

Thanks so much for any help you can provide! :)
For such actions you can use the InputText plugin.
Do you have written (at least partially) the skin which you want to use to enter the data? If so, please post its code.
And as a side note, I mention that in such cases the best idea is to create a file which will keep the values of the variables which have to be used in multiple skins. Let's name it Variables.inc and place it in the @Resources folder. When a new value of any variable is entered (for example through the InputText plugin), it should have to be written into this Variables.inc file, then this file has to be added to each skin which uses the variables kept in the file (through @Include options).
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Capturing User Input?

Post by eclectic-tech »

Writing settings skins that capture user inputs can be done as balala said above...

The best way to understand how they work is by dissecting a working example, so I would suggest reading the manual balala referred to for the UserInput plugin, and then look at an example skin, maybe this one, to see how that plugin is used.

That link also contain a link to an Auto-It executable, that many user find is an easier way to get user input without a lot of coding. The main disadvantage of this method is that It does not let you change the style to match your skins, but it is a quick way to get user inputs while you write your customized user input skin.

Hope this helps you understand the methods available to get user input. :welcome:
Bloodlvst
Posts: 2
Joined: April 30th, 2018, 12:09 am

Re: Capturing User Input?

Post by Bloodlvst »

Thanks to the both of you! :)

It doesn't look nice and pretty yet, but it's functional and writing my variable to my Settings.inc file like I want. I should be able to go from here. I'll post the code once it's "done" just to have an expert look it over in case I'm being inefficient in my code.

Cheers!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Capturing User Input?

Post by balala »

Bloodlvst wrote:It doesn't look nice and pretty yet, but it's functional and writing my variable to my Settings.inc file like I want. I should be able to go from here. I'll post the code once it's "done" just to have an expert look it over in case I'm being inefficient in my code.
Ok, post it, if you want.