It is currently May 3rd, 2024, 12:09 pm

Variables as .inc statements...?

Get help with creating, editing & fixing problems with skins
CybOrSpasm
Posts: 146
Joined: January 8th, 2011, 7:12 pm
Location: Tennessee

Variables as .inc statements...?

Post by CybOrSpasm »

I have a menu skin that uses a Programs.inc file to list the contents of my menu... Now, with the ability to use the scroll wheel to trigger bangs, I thought it would be cool to use the mouse scroll to toggle through multiple possible menus, in other words, maybe have a Programs1.inc, a Programs2.inc and perhaps a Folders.inc etc. Which would mean a !bang that would change which @include to... well.. include, for each click of the mouse wheel. };] But I don't think it is possible to make an @Include a variable, correct? Nor can I see a way to use !WriteKeyValue to change which @Include to use... Understand? Or did I just loose you all? };]
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Variables as .inc statements...?

Post by Kaelri »

You can do both of those things. You can use a variable in an included file path, as long as the variable is defined "before" the statement:

Code: Select all

[Variables]
MyIncludeFile=Programs1
@include=#MyIncludeFile#.inc
Or you can use !WriteKeyValue to change the file path:

Code: Select all

[!WriteKeyValue "Section" "@include" "Programs1.inc"]
(Replace "Section" with whichever section contains the statement, e.g. "Rainmeter", "Variables", etc.)
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Variables as .inc statements...?

Post by eclectic-tech »

CybOrSpasm wrote:I have a menu skin that uses a Programs.inc file to list the contents of my menu... Now, with the ability to use the scroll wheel to trigger bangs, I thought it would be cool to use the mouse scroll to toggle through multiple possible menus, in other words, maybe have a Programs1.inc, a Programs2.inc and perhaps a Folders.inc etc. Which would mean a !bang that would change which @include to... well.. include, for each click of the mouse wheel. };] But I don't think it is possible to make an @Include a variable, correct? Nor can I see a way to use !WriteKeyValue to change which @Include to use... Understand? Or did I just loose you all? };]
Interesting idea... hope you'll share what you come up with!
CybOrSpasm
Posts: 146
Joined: January 8th, 2011, 7:12 pm
Location: Tennessee

Re: Variables as .inc statements...?

Post by CybOrSpasm »

Interesting idea... hope you'll share what you come up with!
@eclectic-tech:

If I get something to work, I will gladly post the code. I would share my whole layout, but the problem is that it is rather computer specific... Oddball resolution of 1280x768 etc.. Perhaps I will re-write just one of the "slide show" pictures so people can at least tear it apart to see how it works. };]