It is currently May 7th, 2024, 2:05 am

Text editor skin?

Get help with creating, editing & fixing problems with skins
User avatar
Active Colors
Moderator
Posts: 1255
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Text editor skin?

Post by Active Colors »

Yincognito wrote: February 10th, 2022, 1:20 pm Sorry for the delay, I was busy with some other stuff as well. This should do what I think you wanted in the above code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]
CurrentInput="Blank File"
Store=iiiiiiiiiiiiii

[MeterButton]
Meter=String
FontSize=12
FontColor=255,156,0
SolidColor=100,100,100,0
StringStyle=Bold
Padding=5,5,5,5
AntiAlias=1
Text=X
LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1"]

[MeterInputLabel]
Meter=String
X=25
Y=0r
W=170
FontSize=12
FontColor=255,156,0
SolidColor=100,100,100,50
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
DynamicVariables=1
Text=#CurrentInput#

[MeterPerma]
Meter=String
X=210
Y=0r
W=170
;H=18
FontSize=12
FontColor=255,156,0
SolidColor=100,100,100,50
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
DynamicVariables=1
Text=#Store#

[MeasureInput]
Measure=Plugin
Plugin=InputText
X=27
Y=4
W=171
H=20
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
FocusDismiss=1
DefaultValue=#CurrentInput#
Command1=[!SetVariable CurrentInput "$UserInput$"][!SetVariable Store "[MeasureInput]"][!WriteKeyValue Variables Store "[MeasureInput]"][!UpdateMeter *][!Redraw]
DynamicVariables=1
I don't think this solves your original problem though. First, what you do in the above code is write things to the SAME file. Sure, this can be changed to write to some other existing INI/INC file, but it won't be "multiline" the way you think, since each line would basically be an option that can be overwritten, and that ends as soon as the newline character is encountered...

EDIT: ActiveColors beat me to it, but there are some differences between the codes.
Yeah I was not sure what was going on in the skin so I just reduced the amount of 'logic' :d
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Text editor skin?

Post by ItsJustRyan »

Yincognito wrote: February 10th, 2022, 1:46 pm Which begs the question ... what you intended? :confused:
I intended to have that text editor kind of thing, but I didn't imagine how the !WriteKeyValue bang worked correctly and didnt get the intended effect. Right now I'm looking into how to use lua script in rainmeter for the read/write lua library
User avatar
Active Colors
Moderator
Posts: 1255
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Text editor skin?

Post by Active Colors »

Yincognito,
I have just come up with an idea that it might be possible to create a multi-line text editor skin but there are some issues and I don't know if they can be fixed. See the gif below with the issues in-action:
GIF.gif
You do not have the required permissions to view the files attached to this post.
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Text editor skin?

Post by ItsJustRyan »

Active Colors wrote: February 10th, 2022, 2:27 pm Yincognito,
I have just come up with an idea that it might be possible to create a multi-line text editor skin but there are some issues and I don't know if they can be fixed. See the gif below with the issues in-action:
GIF.gif
Lol I'm struggling to even get the code to read a text file.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]

[MeasureScript]
Measure=Script
ScriptFile=ReadFile.lua
;Disabled=1

[MeterReadOut]
Meter=String
X=25
Y=0
W=170
FontSize=12
FontColor=255,156,0
SolidColor=100,100,100,50
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
DynamicVariables=1
Text=[&MeasureScript:ReadFile('data.txt')]
Forgive the formatting it was taken from my previous attempt. Currently data.txt is just a text file with random filler text, and the ReadFile.lua is taken from Rainmeter's read-write file documentation.
User avatar
Active Colors
Moderator
Posts: 1255
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Text editor skin?

Post by Active Colors »

ItsJustRyan wrote: February 10th, 2022, 2:36 pm Lol I'm struggling to even get the code to read a text file.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]

[MeasureScript]
Measure=Script
ScriptFile=ReadFile.lua
;Disabled=1

[MeterReadOut]
Meter=String
X=25
Y=0
W=170
FontSize=12
FontColor=255,156,0
SolidColor=100,100,100,50
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
DynamicVariables=1
Text=[&MeasureScript:ReadFile('data.txt')]
Forgive the formatting it was taken from my previous attempt. Currently data.txt is just a text file with random filler text, and the ReadFile.lua is taken from Rainmeter's read-write file documentation.
I was about to post my test code but you were faster than me because I was cleaning up my test code.

Lua could be the approach but due to my lack of experience with lua I use Quote plugin to read a text file. https://docs.rainmeter.net/manual/plugins/quote/

This is how it is done with Quote plugin:

Code: Select all

[MeasureNotes]
Measure=Plugin
Plugin=QuotePlugin
PathName=#@#Note.txt
Separator=¶

[MeterNotes]
Meter=String
MeasureName=MeasureNotes
Text=%1
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Text editor skin?

Post by jsmorley »

Plugin=QuotePlugin
User avatar
Active Colors
Moderator
Posts: 1255
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Text editor skin?

Post by Active Colors »

jsmorley wrote: February 10th, 2022, 2:47 pm Plugin=QuotePlugin
Was also about to point about that it could be good to add another option to use simply "Quote" because the "Plugin" part looks rudimentary.
Also, on the sidebar of the documentation and in the title of the page it says "Quote plugin" while it had to be "QuotePlugin plugin".

EDIT: I fixed the mistake in my reply above.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Text editor skin?

Post by jsmorley »

Active Colors wrote: February 10th, 2022, 2:53 pm Was also about to point about that it could be good to add another option to use simply "Quote" because the "Plugin" part looks rudimentary.
Also, on the sidebar of the documentation and in the title of the page it says "Quote plugin" while it had to be "QuotePlugin plugin".
Yeah, let us chew on this a bit. I also hate the redundancy of QuotePlugin.
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Text editor skin?

Post by ItsJustRyan »

Code: Select all

[MeasureNotes]
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]

[MeasureNotes]
Measure=Plugin
Plugin=QuotePlugin
PathName=#@#data/data.txt
;Separator=¶

[MeterNotes]
Meter=String
MeasureName=MeasureNotes
X=25
Y=0
W=170
FontSize=12
FontColor=255,156,0
SolidColor=100,100,100,50
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
DynamicVariables=1
Text=%1
It does not appear to want to work :/
User avatar
Active Colors
Moderator
Posts: 1255
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Text editor skin?

Post by Active Colors »

ItsJustRyan wrote: February 10th, 2022, 3:00 pm

Code: Select all

[MeasureNotes]
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]

[MeasureNotes]
Measure=Plugin
Plugin=QuotePlugin
PathName=#@#data/data.txt
;Separator=¶

[MeterNotes]
Meter=String
MeasureName=MeasureNotes
X=25
Y=0
W=170
FontSize=12
FontColor=255,156,0
SolidColor=100,100,100,50
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
DynamicVariables=1
Text=%1
It does not appear to want to work :/
Are you sure your data.txt file is in /@Resources/data/ directory?
Also, you commented out Separator=¶ with semi-column. You need to remove the semi-column in order to properly display line-breaks.