It is currently May 1st, 2024, 5:31 am

InputText.dll related Meter is not refreshing

Get help with creating, editing & fixing problems with skins
Fried_Ice
Posts: 6
Joined: December 16th, 2011, 6:50 pm
Location: Germany

InputText.dll related Meter is not refreshing

Post by Fried_Ice »

Hi guys.
Im editing a new Theme for Rainmeter, which is also including a Meter to plce Notes via the InputText.dll.
It is able to write the userinput into a seperate file and display it as a meter.
But i have to refresh all Meters via "RainmeterRefresh" in order to display the new String.
"RainmeterRefresh #CURRENTCONFIG#" doesn't work for me.

Here is my code:

Code: Select all

;=====================================
; Simple Notes
; by Fried_Ice
;=====================================

[Rainmeter]
Author=Fried_Ice 
Version=1.0
AppVersion=1001000
DynamicWindowSize=1


;Metadata added by RainBrowser
;http://rainmeter.net/RainCMS/?q=Rainmeter101_AnatomyOfASkin

[Metadata]
Name= Fried_Ice
Config=#SKINSPATH#\Gentle Grey\settings.conf
Description=Just a simple Note Tool - Click the grey box to dropout a menu for choosing your active note
Instructions=
Version=
Tags=
License=
Variant=
Preview=

;End of added Metadata
[Variables]

@include="#SKINSPATH#\Gentle Grey\Settings.conf"
@include2="#CURRENTPATH#Memo.inc"


;=====================================================
;[Measures]===========================================
;=====================================================

;===Measure=1 for drawing a complete circle====
[MeasureCalc1]
Measure=Calc
Formula=3/3
;===Setting UpdateDivider to -1 to only calc once
UpdateDivider=-1

;===InputMeasures===
[MeasureInputMemo]
Measure=Plugin
Plugin=InputText.dll
SolidColor=#ColorBackground#
FontColor=#ColorMain#
FontFace=#FontFace#
FocusDismiss=1
FontSize=12
X=-250
Y=5
H=180
W=240

Command1=!RainmeterWriteKeyValue Variables Memo1 "$UserInput$" "#CURRENTPATH#Memo.inc" DefaultValue="#Memo1#"
Command2=!RainmeterRefresh #CURRENTCONFIG#

Command3=!RainmeterWriteKeyValue Variables Memo2 "$UserInput$" "#CURRENTPATH#Memo.inc" DefaultValue="#Memo2#"
Command4=!RainmeterRefresh #CURRENTCONFIG#

Command5=!RainmeterWriteKeyValue Variables Memo3 "$UserInput$" "#CURRENTPATH#Memo.inc" DefaultValue="#Memo3#"
Command6=!RainmeterRefresh #CURRENTCONFIG#


;=====================================================
;[Graphics]===========================================
;=====================================================

;===Painting the environment===
[MeterHeaderSurroundLeft]
Meter=Roundline
MeasureName=MeasureCalc1
LineColor=#ColorSurround#
LineLength=20
X=0
Y=25
H=40
W=40
Solid=1
AntiAlias=1

[MeterHeaderSurroundCentral]
Meter=Image
SolidColor=#ColorSurround#
X=17.5
Y=25
H=40
W=140

[MeterHeaderSurroundRight]
Meter=Roundline
MeasureName=MeasureCalc1
LineColor=#ColorSurround#
LineLength=20
X=135
Y=25
H=40
W=40
Solid=1
AntiAlias=1

[MeterHeaderBackground]
Meter=Image
SolidColor=#ColorBackground#
X=17.5
Y=30
H=30
W=140
LeftMouseDownAction=!Execute [!ToggleMeterGroup Dropouts]

[MeterHeaderString]
Meter=String
Text=#MemoTitle#
X=87.5
Y=23.5
StringAlign=Center
FontFace=#FontFace#
FontColor=#ColorMain#
FontSize=#FontSize#
AntiAlias=1

;===Beginning of different Notes===
[Meter1stNote]
Meter=String
X=10
Y=70
FontSize=10
FontColor=#ColorSurround#
AntiAlias=1
DynamicVariables=1
Text=#Memo1#
LeftMouseUpAction=!Execute [!CommandMeasure "MeasureInputMemo" "ExecuteBatch 1-2"] [!HideMeterGroup Dropouts]
Hidden=0

[Meter2ndNote]
Meter=String
X=10
Y=70
FontSize=10
FontColor=#ColorSurround#
AntiAlias=1
DynamicVariables=1
Text=#Memo2#
LeftMouseUpAction=!Execute [!CommandMeasure "MeasureInputMemo" "ExecuteBatch 3-4"] [!HideMeterGroup Dropouts]
Hidden=1

[Meter3rdNote]
Meter=String
X=10
Y=70
FontSize=10
FontColor=#ColorSurround#
AntiAlias=1
DynamicVariables=1
Text=#Memo3#
LeftMouseUpAction=!Execute [!CommandMeasure "MeasureInputMemo" "ExecuteBatch 5-6"] [!HideMeterGroup Dropouts]
Hidden=1

;===Beginning of different Dropboxes===
[Meter1stDropoutBox]
Meter=Image
SolidColor=#ColorBackground#
X=20
Y=0
W=41.67
H=20
Group=Dropouts
Hidden=1
LeftMouseDownAction=!Execute [!ToggleMeterGroup Dropouts] [!ShowMeter Meter1stNote] [!HideMeter Meter2ndNote] [!HideMeter Meter3rdNote]

[Meter2ndDropoutBox]
Meter=Image
SolidColor=#ColorBackground#
X=66.7
Y=0
W=41.67
H=20
Group=Dropouts
Hidden=1
LeftMouseDownAction=!Execute [!ToggleMeterGroup Dropouts] [!ShowMeter Meter2ndNote] [!HideMeter Meter1stNote] [!HideMeter Meter3rdNote]

[Meter3rdDropoutBox]
Meter=Image
SolidColor=#ColorBackground#
X=113.37
Y=0
W=41.67
H=20
Group=Dropouts
Hidden=1
LeftMouseDownAction=!Execute [!ToggleMeterGroup Dropouts] [!ShowMeter Meter3rdNote] [!HideMeter Meter1stNote] [!HideMeter Meter2ndNote]
;===Beginning of Dropout Strings===

[Meter1stDropouString]
Meter=String
FontFace=Times New Roman
Text="I"
FontSize=15
FontColor=#ColorSurround#
AntiAlias=1
StringAlign=Center
X=40.835
Y=-1
Group=Dropouts
Hidden=1

[Meter2ndDropouString]
Meter=String
FontFace=Times New Roman
Text="II"
FontSize=15
FontColor=#ColorSurround#
AntiAlias=1
StringAlign=Center
X=87.505
Y=-1
Group=Dropouts
Hidden=1

[Meter3rdDropouString]
Meter=String
FontFace=Times New Roman
Text="III"
FontSize=15
FontColor=#ColorSurround#
AntiAlias=1
StringAlign=Center
X=134.175
Y=-1
Group=Dropouts
Hidden=1
--> The missing variables are in a seperated config file.
The next problem I got is to enable the user to create a new line without typing "#CRLF#" everytime...is there a standart LUA Script I can use?

Thank you in advance!
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InputText.dll related Meter is not refreshing

Post by jsmorley »

InputText will not allow a simple "enter" to create a new line, as the Windows control it is using uses that as "commit" in a sense. So the user is going to have to use some character as a "newline" in the input. As you say, today it works with #CRLF#, but that is kinda cumbersome for the user.

It could probably be done by using another character, I would propose | (pipe) and then passing the input through a Lua script that changes all "|" to "#CRLF#" before it writes to the file.

So the user types "This is line one|and this is line two"

If you can post your include file, so I have the external variables, I can probably work something up that might fit the bill. I can figure out what is going on with your !Refresh #CURRENTCONFIG# at the same time.
Fried_Ice
Posts: 6
Joined: December 16th, 2011, 6:50 pm
Location: Germany

Re: InputText.dll related Meter is not refreshing

Post by Fried_Ice »

Here we go.
At first my seperated Variables...to adjust the colors anf FontFaces for the whole Theme at once: settings.conf:

Code: Select all

[Variables]
ColorMain=141, 202, 0,
ColorBackground=61, 61, 61
ColorSurround=255, 255, 255
MemoTitle=My Notes
FontSize=25
FontFace=Calibri

And now the temporary content of the Memo.inc File:

Code: Select all

[Variables]

Memo1=Let's get startet. Click the grey rectangle!
Memo2=You made it!
Memo3=Now you can manage 3 different notes!
And next: Yeah I know I couldn´t use the Enter Button in order to get a new line, thats why I asked wether you can tell how I could write such a LUA script (beacause I never did this before), or wether you could tell me how to substitute the #CRLF#, because I wasn't able to.

Edit: Oh I got your message wrong^^...nevermind.
Thanks in advance;D
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: InputText.dll related Meter is not refreshing

Post by smurfier »

Here's a real quick Lua script that will fire the !WriteKeyValue bang after substituting out every pipe delimiter for #CRLF#.

Lua.lua

Code: Select all

function WriteKey(key,text,file)
	text=string.gsub(text,'%|','%#CRLF%#')
	file=SKIN:MakePathAbsolute(file)
	SKIN:Bang('!WriteKeyValue','Variables',key,text,file)
	SKIN:Bang('!Refresh')
end
Create a script measure for it, then call it using !CommandMeasure

Code: Select all

[Lua]
Measure=Script
ScriptFile=Lua.lua
UpdateDivider=-1
Then call the script using !CommandMeasure Lua """WriteKey('Memo1','$UserInput$','Memo.txt')""" "#CURRENTCONFIG#"
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InputText.dll related Meter is not refreshing

Post by jsmorley »

A couple of other notes:

-The problem with refreshing the skin is solved by putting quotes around #CURRENTCONFIG# in the commands. Command2=!Refresh "#CURRENTCONFIG#". This is due to the fact that your config has spaces in the name. However, there really is no need to specify the config on !Refresh to refresh the current skin. Just use "!Refresh" and it will refresh the skin it is in.

In any case, if you use the Lua script Smurfier posted, it is a moot point. Just for the future.

-You can't use fractional values on X, Y, W or H. They are measures of "pixels" and there is no such thing as .318 of a pixel.

-Do not use the prefix "Rainmeter" on bangs, like !RainmeterRefresh. Just use !Refresh. The "Rainmeter" prefix has been deprecated.

-Adding SolidColor=0,0,0,1 to the [MeterXstNote] meters makes them easier to click on as that setting draws an invisible box around the meter.
Fried_Ice
Posts: 6
Joined: December 16th, 2011, 6:50 pm
Location: Germany

Re: InputText.dll related Meter is not refreshing

Post by Fried_Ice »

WOW that was an huge amount of information, thanks.
The tip with putting the #CURRENTPATH# in quotes works and I implementet you additional tips.

But I hae to admit I failed at implementing the script.
Here you can see how I implemented the script into the skin;

Code: Select all

...
[Lua]
Measure=Script
ScriptFile=NewLine.lua
UpdateDivider=-1

;===InputMeasures===
[MeasureInputMemo]
Measure=Plugin
Plugin=InputText.dll
SolidColor=#ColorBackground#
FontColor=#ColorMain#
FontFace=#FontFace#
FocusDismiss=1
FontSize=12
X=-250
Y=5
H=180
W=240


Command1=!CommandMeasure Lua WriteKey('Memo1','$UserInput$','Memo.inc') "#CURRENTCONFIG#"
...
...
...
[Meter1stNote]
Meter=String
X=10
Y=70
FontSize=10
FontColor=#ColorSurround#
AntiAlias=1
DynamicVariables=1
Text=#Memo1#
SolidColor=0,0,0,1
LeftMouseUpAction=!Execute [!CommandMeasure "MeasureInputMemo" "ExecuteBatch 1"] [!HideMeterGroup Dropouts]
Hidden=0
...
I can type text and it is saved in the memo.inc file, but it fails at texts having space charakters in it and also the | doesnt work, only the first line is saved and displayed as well as the text gets deleted everytime I call the !WriteKey Bang so that I don't have the possibility to only edit the text.

Is this my fault by implementing the script wrongly?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: InputText.dll related Meter is not refreshing

Post by smurfier »

Because of the spaces we need to put the WriteKey() part in quotes. I recommend Magic Quotes so that you can use quotes in the text itself.

!CommandMeasure Lua """WriteKey('Memo1','$UserInput$','Memo.txt')""" "#CURRENTCONFIG#"
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .