It is currently May 7th, 2024, 12:40 pm

Code problem with !RainmeterSetOption and external code

Get help with creating, editing & fixing problems with skins
nawmtaronyu
Posts: 64
Joined: July 21st, 2010, 3:30 am

Code problem with !RainmeterSetOption and external code

Post by nawmtaronyu »

I'm doing a skin that with have 4 variations to it and for that reason I need to use an external Config file for Icons, Text, and Launch Directory's for easy switching.

Anyway I'm doing it similarly as my last skin http://nawmtaronyu.deviantart.com/gallery/#/d4m7y2f but im using the new !SetOption to do the hovering effects, but it doesn't seem to be seeing the #text1# on my Config file

Code: Select all

Launcher.ini

@include="#SKINSPATH#\launcher\Config.txt"

[Icon1]
Meter=Image
ImageName=#icon1#
w=38
h=38
x=20
MouseOverAction=!Execute [!RainmeterSetOption Title Text #text1#][!RainmeterSetOption Icon1 x 18][!RainmeterSetOption Icon1 y -2][!RainmeterSetOption TitleS Text #text1#][!RainmeterSetOption Icon1 w 42][!RainmeterSetOption Icon1 h 42][!RainmeterRedraw]
MouseLeaveAction=!Execute [!RainmeterSetOption Title Text ""][!RainmeterSetOption TitleS Text ""][!RainmeterSetOption Icon1 w 38][!RainmeterSetOption Icon1 h 38][!RainmeterRedraw]
LeftMouseUpAction=!Execute ["#Dir1#"]
Hidden=#H1#
Group=1

Code: Select all

Config.txt

icon1=Icons\Photoshop.png
text1="Photoshop"
Dir1=
Since that did not work I tried to Loop it through variables, by adding text1=#text1-1# in variables and changed config to text1-1=Photoshop. but still does not work anyone know why or has encountered this problem have a way around it.
Image
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Code problem with !RainmeterSetOption and external code

Post by Brian »

I can't see anything obvious to explain why the text isn't showing up. Do the other variables in your "config.txt" work correctly?

Did you try putting quotes in your bang? Like this: [!RainmeterSetOption Title Text "#text1#"]

Does your "Photoshop.png" have a lot of transparency in it? If so, add a almost invisible SolidColor to your meter. Like this: SolidColor=0,0,0,1

The only other thing I will say is that !SetOption cannot be used to change your X and Y values in meters. Check !SetOption Guide for more information.

-Brian
User avatar
Arne Anka
Posts: 100
Joined: April 18th, 2009, 11:31 am
Location: Sweden

Re: Code problem with !RainmeterSetOption and external code

Post by Arne Anka »

Remove the backslash in the includeline?

Code: Select all

@include="#SKINSPATH#launcher\Config.txt"
:???:
Livet är bara en period man ska överleva.
Som filosoferna säger: man föds, man lever och man dör ensam...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Code problem with !RainmeterSetOption and external code

Post by jsmorley »

If you want to have an external include file that contains variables, the file must have [Variables] in it so Rainmeter knows that is what they are. Even if the @Include is contained in the [Variables] section of the skin, the .inc file MUST have a section [Variables] in it with anything you want to use a variable in the skin in it.

Skin:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
@Include=Includes\MyVars.inc
Var4=Black
MyVars.inc:

Code: Select all

[Variables]
Var1=Red
Var2=Green
Var3=Blue
Geeky note:

This is because even though we name include files .inc (or really anything we want) they are still loaded and parsed by Rainmeter using the routines that understand a standard INI file. This requires [Sections] and Key=Values.

While the @Include file is in a sense "inserted" in the skin file at the location it is placed, Rainmeter does not insert the text from the file and then completely "re-parse" the skin, It reads the .inc file using standard .ini parsing routines, then inserts the new sections into the skin.

We have designed the routines in a way that there can be more than one [Variables] section, (which is normally forbidden in a .INI format file) and the variables from all the [Variables] sections, the one in the skin and any found in @Include files are merged together. However, since the include file must be in the standard .INI format, anything in it that is not contained in a [Section] is ignored.
nawmtaronyu
Posts: 64
Joined: July 21st, 2010, 3:30 am

Re: Code problem with !RainmeterSetOption and external code

Post by nawmtaronyu »

jsmorley wrote:If you want to have an external include file that contains variables, the file must have [Variables] in it so Rainmeter knows that is what they are. Even if the @Include is contained in the [Variables] section of the skin, the .inc file MUST have a section [Variables] in it with anything you want to use a variable in the skin in it.

Skin:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
@Include=Includes\MyVars.inc
Var4=Black
MyVars.inc:

Code: Select all

[Variables]
Var1=Red
Var2=Green
Var3=Blue
Geeky note:

This is because even though we name include files .inc (or really anything we want) they are still loaded and parsed by Rainmeter using the routines that understand a standard INI file. This requires [Sections] and Key=Values.

While the @Include file is in a sense "inserted" in the skin file at the location it is placed, Rainmeter does not insert the text from the file and then completely "re-parse" the skin, It reads the .inc file using standard .ini parsing routines, then inserts the new sections into the skin.

We have designed the routines in a way that there can be more than one [Variables] section, (which is normally forbidden in a .INI format file) and the variables from all the [Variables] sections, the one in the skin and any found in @Include files are merged together. However, since the include file must be in the standard .INI format, anything in it that is not contained in a [Section] is ignored.
Thank you, such a stupid mistake I forgot the [Variables] in the Config.txt, and thanks for the info on !SetOption not working on x and y, didn't realize that till I got the icon working makes my hover effect not as nice but still good. Thank you.
Image
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Code problem with !RainmeterSetOption and external code

Post by smurfier »

nawmtaronyu wrote: Thank you, such a stupid mistake I forgot the [Variables] in the Config.txt, and thanks for the info on !SetOption not working on x and y, didn't realize that till I got the icon working makes my hover effect not as nice but still good. Thank you.
You can use !MoveMeter to move your meter.
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 . . .