It is currently April 18th, 2024, 4:48 pm

Dynamic Display Text

Get help with creating, editing & fixing problems with skins
vulcanrvn90
Posts: 11
Joined: April 4th, 2020, 9:20 am

Dynamic Display Text

Post by vulcanrvn90 »

Hello,

I've searched on here and on reddit, perhaps I'm searching the wrong thing but I'm trying to edit a skin someone else created and need a little help, please. I want the skin to display the text in the referenced txt document and to have the displayed text box increase or decrease its size based on what is in the text document, also to be scrollable if able for anything that isn't being displayed. I only want the text box to grow to a max size though so would I just have to add a MaxW MaxH then create a container?

Thank You

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[BlockBackground]
Meter=Image
ImageName=#@#Images\background.png
ImageTint=255, 255, 255, 1
W=310
H=310

[Variables]
Title=Notes
@Include=#CURRENTPATH#
MaxW=(#Width#-#XOffset#*2)


[MeterAdd1]
Meter=Image
ImageName=#@#Images\Notes.png
H=20
W=20
X=10
Y=345
LeftMouseUpAction=!Execute [!RainmeterRedraw] [notepads "#CURRENTPATH#\Notes.txt"]


[MeterLine]
Meter=String
H=1
W=280
X=
Y=
SolidColor=255,255,255
Hidden=1

;-----------------

[MeasureText]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#CURRENTPATH#\Notes.txt
Separator=¶


[MeterText]
MeasureName=MeasureText
Meter=STRING
X=
Y=5
H=330
W=280
FontColor=255,255,255
FontSize=12
FontFace=Roboto
TextStyle=Bold
StringAlign=Left
AntiAlias=1
Clipstring=1
DynamicVariables=1


[MeterLine2]
Meter=String
H=1
W=280
X=
Y=375
SolidColor=255,255,255
Hidden=1
Last edited by Brian on May 15th, 2020, 4:45 am, edited 1 time in total.
Reason: Please use [code] tags. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dynamic Display Text

Post by balala »

vulcanrvn90 wrote: May 15th, 2020, 4:26 am I've searched on here and on reddit, perhaps I'm searching the wrong thing but I'm trying to edit a skin someone else created and need a little help, please. I want the skin to display the text in the referenced txt document and to have the displayed text box increase or decrease its size based on what is in the text document, also to be scrollable if able for anything that isn't being displayed. I only want the text box to grow to a max size though so would I just have to add a MaxW MaxH then create a container?
Let's summarize a little bit, because I'm not sure I entirely follow what you want. So if I'm not mistaken, you read a line of the Notes.txt file, through the [MeasureText] Quote plugin measure and you'd like to show the read string through the [MeterText] meter, which should extend from an initial small size up to a larger one, depending on the size of the shown string. If the string which has to be shown is larger then the maximum size of the [MeterText] meter, the string inside should become scrollable. Is this right?

Additionally a few comments related to the posted code, which should be always taken into account (even if you are reusing an older code, which I think you did):
  • Both the !Execute bang and the !Rainmeter... bang prefix are deprecated and shouldn't be used. For backward compatibility reasons they are working, but as said, shouldn't be used. Remove them please.
  • I suppose by the [notepads "#CURRENTPATH#\Notes.txt"] bang of the LeftMouseUpAction option of the [MeterAdd1] meter you want to open the Notes.txt file, into notepad. Am I right? If I am, this doesn't work this way, especially that notepads means nothing, the name of the appropriate application is Notepad (even if case insensitive), or even better Notepad.exe. So replace it with and of the followings: [notepad "#CURRENTPATH#\Notes.txt"], [notepad.exe "#CURRENTPATH#\Notes.txt"], or even the much simpler ["#CURRENTPATH#\Notes.txt"] (in last case the file open into the default text editor).
  • The @Include=#CURRENTPATH# option used into the [Variables] section does nothing, because #CURRENTPATH# is referencing a folder, but you can't include a folder into the skin. A file should be included this way, but not a folder.
  • Doesn't worth too much to redraw the skin when you're clicking the above [MeterAdd1] meter, to open the Notes.txt file. Nothing is set on the skin, so why to redraw it? Remove the [!RainmeterRedraw] (or [!Redraw], which I explained above why should be used) bang of the LeftMouseUpAction option of the [MeterAdd1] meter.
vulcanrvn90
Posts: 11
Joined: April 4th, 2020, 9:20 am

Re: Dynamic Display Text

Post by vulcanrvn90 »

Bingo! you nailed exactly what I'm looking for. Sorry for the late reply and confusion. I really appreciate the information and help

1. I will remove the deprecated bangs I didn't realize they were no longer being used.
2. While you are correct about the second point, notepads is actually the name of the application, it is a notepad replacement that I use, which is coincidentally not my default txt editor either
3. I will remove that thank you for the clarification, I was messing around with getting notepads to work and once I figured it out I forgot to remove this.
4. I will change this as well thank you
balala wrote: May 15th, 2020, 8:25 am Let's summarize a little bit, because I'm not sure I entirely follow what you want. So if I'm not mistaken, you read a line of the Notes.txt file, through the [MeasureText] Quote plugin measure and you'd like to show the read string through the [MeterText] meter, which should extend from an initial small size up to a larger one, depending on the size of the shown string. If the string which has to be shown is larger then the maximum size of the [MeterText] meter, the string inside should become scrollable. Is this right?

Additionally a few comments related to the posted code, which should be always taken into account (even if you are reusing an older code, which I think you did):
  • Both the !Execute bang and the !Rainmeter... bang prefix are deprecated and shouldn't be used. For backward compatibility reasons they are working, but as said, shouldn't be used. Remove them please.
  • I suppose by the [notepads "#CURRENTPATH#\Notes.txt"] bang of the LeftMouseUpAction option of the [MeterAdd1] meter you want to open the Notes.txt file, into notepad. Am I right? If I am, this doesn't work this way, especially that notepads means nothing, the name of the appropriate application is Notepad (even if case insensitive), or even better Notepad.exe. So replace it with and of the followings: [notepad "#CURRENTPATH#\Notes.txt"], [notepad.exe "#CURRENTPATH#\Notes.txt"], or even the much simpler ["#CURRENTPATH#\Notes.txt"] (in last case the file open into the default text editor).
  • The @Include=#CURRENTPATH# option used into the [Variables] section does nothing, because #CURRENTPATH# is referencing a folder, but you can't include a folder into the skin. A file should be included this way, but not a folder.
  • Doesn't worth too much to redraw the skin when you're clicking the above [MeterAdd1] meter, to open the Notes.txt file. Nothing is set on the skin, so why to redraw it? Remove the [!RainmeterRedraw] (or [!Redraw], which I explained above why should be used) bang of the LeftMouseUpAction option of the [MeterAdd1] meter.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dynamic Display Text

Post by balala »

vulcanrvn90 wrote: May 20th, 2020, 5:25 pm Bingo! you nailed exactly what I'm looking for. Sorry for the late reply and confusion. I really appreciate the information and help
Ok, I'm glad if you got it working well.
vulcanrvn90 wrote: May 20th, 2020, 5:25 pm 1. I will remove the deprecated bangs I didn't realize they were no longer being used.
Although those bangs still can be used (due to the backward compatibility), they should not be. It's better to get used to not use them. However if you're using them, the skin will still work.
vulcanrvn90
Posts: 11
Joined: April 4th, 2020, 9:20 am

Re: Dynamic Display Text

Post by vulcanrvn90 »

Oh no, I'm sorry I didn't get the skin working well as far as the changing of the displayed text box size. The only thing I got working well is opening with the correct text editor.

I still very much need help, please. I feel like I've gone through the documentation part of the site so many times that I'm just overlooking what I want to do.
balala wrote: May 20th, 2020, 5:39 pm Ok, I'm glad if you got it working well.

Although those bangs still can be used (due to the backward compatibility), they should not be. It's better to get used to not use them. However, if you're using them, the skin will still work.
vulcanrvn90
Posts: 11
Joined: April 4th, 2020, 9:20 am

Re: Dynamic Display Text

Post by vulcanrvn90 »

I figured out how to show the text based on the size of the text in the document and to a maximum size. I just add to change clipstring=2 then set the H and W size for the maximum.

One last thing though, can I set an image to move with the bottom of the displayed text box? For instance in the skin now, I have an image called notes.png that acts as a button to launch the preferred text editor and text file that is being displayed. I would like it if this button would also move vertically with the bottom of the text if that makes sense.

Thank You
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dynamic Display Text

Post by balala »

vulcanrvn90 wrote: May 21st, 2020, 1:12 am One last thing though, can I set an image to move with the bottom of the displayed text box? For instance in the skin now, I have an image called notes.png that acts as a button to launch the preferred text editor and text file that is being displayed. I would like it if this button would also move vertically with the bottom of the text if that makes sense.
Yes, it makes. Set a width and a height for the [MeterText] String meter, replacing the W and H options with ClipStringW=280 and ClipStringH=330. Also replace the CilpString option with ClipString=2.
Now the size of the String meter varies up to the value set by the above ClipStringH value.
Finally add after the [MeterText] String meter (take care it is extremely important to add it in code immediately after the string meter), the following Image meter:

Code: Select all

[MeterButton]
Meter=Image
ImageName=#@#notes.png
X=20r
Y=5R
LeftMouseUpAction=...
Add the appropriate LeftMouseUpAction.
vulcanrvn90
Posts: 11
Joined: April 4th, 2020, 9:20 am

Re: Dynamic Display Text

Post by vulcanrvn90 »

I got the button moving correctly with the size of the displayed text thanks to you. However I still cannot scroll if the text in the file is larger than the height parameters I set in the skin ini. I'm not sure how to set that part up. Also, any idea why all the sudden my skin wont open the requested notes.txt file using my app notepads? It opens if I use the default text editor or even if I set it to use notepad, but it wont open with notepads.exe for some reason. I uninstalled and reinstalled the notepads application, it used to work just fine but once I got the text box and button working correctly, it suddenly stopped opening in the correct application.

Thank You
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dynamic Display Text

Post by balala »

vulcanrvn90 wrote: May 26th, 2020, 11:08 am However I still cannot scroll if the text in the file is larger than the height parameters I set in the skin ini. I'm not sure how to set that part up.
I don't say it's impossible, but definitely isn't too easy. Let's see...
vulcanrvn90 wrote: May 26th, 2020, 11:08 am Also, any idea why all the sudden my skin wont open the requested notes.txt file using my app notepads? It opens if I use the default text editor or even if I set it to use notepad, but it wont open with notepads.exe for some reason. I uninstalled and reinstalled the notepads application, it used to work just fine but once I got the text box and button working correctly, it suddenly stopped opening in the correct application.
Are you talking about this?
vulcanrvn90 wrote: May 15th, 2020, 4:26 am

Code: Select all

[MeterAdd1]
Meter=Image
...
LeftMouseUpAction=!Execute [!RainmeterRedraw] [notepads "#CURRENTPATH#\Notes.txt"]
Try to add the complete path of the notepads application, as well as its extension and include them into quotes. Something like: ["C:\Program Files\Notepads\notepads.exe" "#CURRENTPATH#\Notes.txt"].
Does this help?
vulcanrvn90
Posts: 11
Joined: April 4th, 2020, 9:20 am

Re: Dynamic Display Text

Post by vulcanrvn90 »

Unfortunaly I did do that, the application opens but doesn't automatically load the notes.txt file for some reason