It is currently May 13th, 2024, 4:46 pm

theme changer

Get help with creating, editing & fixing problems with skins
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

theme changer

Post by Ivan »

first i have to tell that i am really bad in programming, and that i do not have idea how to even start this, and i have to tell that i do not know anything about programming because i am highly skilled professional in CAD design (and i can prove that as i have CAD blog, but i will not post link here as i think it is not nice thing to do, but if you are interested i will send you link over PM) and that i do not have time to learn programming from scratches to be able to make this myself, so i am completely in your skilled programming hands!

so as i do not know how to make any of skins i am asking you guys to make one for me if possible.
I would love to have theme changer that work two ways, first it read IP address and change theme according to IP [to explain, if i am at work my IP is 111.111.111.111 and i want to have "workplace" theme, if i am at home my IP is 222.222.222.222 so it change to home theme, if no internet then it will start one of preset themes, and i need to be able to change and add more preset IP addresses in .ini file] and second i wish it can change theme by some kind of vertical right side sidebar that will have a button for each preset theme. IP changer will work only at the moment of start up, and buttons will be used any time after start up... (English is not my main so sorry if i sound confused).

i hope this is not too hard and that some of you will help me.
Thank YOU!
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: theme changer

Post by jsmorley »

Rainmeter is not really "programming" as such, and although it does take a bit of effort (a couple of days of messing around with it generally) to get the hang of it, it's not anywhere as complicated as programming in a real language like PHP or C++ or something.

Having said that, if you don't have time to mess with learning it, and that is fair enough, we all have priorities, then I doubt it is going to work out for you. We really just don't allow skin requests on our forums, and nobody here is just going to write it for you. We are happy to help anyone learn, and will provide all kinds of advice, do debugging with you, tips and hints and all that. We won't just do it for you.

Skin Requests

P.S. This process you are trying to do is certainly possible in Rainmeter, and if you are willing to spend some time getting the basics under your belt, I bet there are at least a few guys here already salivating over this little challenge.
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: theme changer

Post by Ivan »

as i have time to mess with rainmeter at all that show that i do have little time for learning new skills, (link you posted was first thing i read when i logged in here) but after yesterday spending whole afternoon to figure out how to make this, and nobody helped me with some start up tutorial for what i think is easy rotator... i give up hope that i will find any kind of help/tutorial/guide here to build something like theme changer.
so as i see that you are active mod here, please help me with advice, tutorials and any other way, as i couldn't find help here in last few days.
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: theme changer

Post by Ivan »

the colorful one is my current desktop, gray one is my desktop few days ago:
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: theme changer

Post by jsmorley »

Well, in general you want to start here:

http://rainmeter.net/cms/Rainmeter101 If you read through that and do at least one of the simple tutorials at the end, Rainmeter will become a lot less of a mystery. It's a great place to start.

Then you are going to want to have the manual handy while you are playing with things:

http://rainmeter.net/cms/Manual

For instance there is a pretty decent explanation of a Rotator meter here

http://rainmeter.net/cms/Meters-Rotator

Complete with a simple example skin.


Anyway, I think for your "theme changer skin", you are going to want to base it on a WebParser measure that goes out and gets your IP address. Something like:

[MeasureIPWeb]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
UpdateRate=-1

Then the measure [MeasureIPWeb] will contain your external IP address. If you can and want to base this on your internal (LAN) IP address instead, you could use something like:

[MeasureIPLan]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=IP_ADDRESS

Then [MeasureIPLan] will contain your IP address on your local area network.

Now I need to think a bit about how best to translate that into calls to SkinInstaller.exe with the /LoadTheme parameter... We will end up using #PROGRAMPATH#SkinInstaller /LoadTheme "ThemeName", but we want to be careful we don't get in an endless loop, so we are probably going to have to store the current IP address somewhere so we only change the theme when the IP changes. I think using a Lua script to handle things is going to be the most flexible, let me chew on it for a bit.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: theme changer

Post by smurfier »

Does it need to be based on an ip address or will the SSID (network name) of the currently connected Wireless network be good enough?
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: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: theme changer

Post by jsmorley »

smurfier wrote:Does it need to be based on an ip address or will the SSID (network name) of the currently connected Wireless network be good enough?
Doubt that he is "wireless" at work, but yeah, if he is wireless both home and at work that would be a way to go, as it avoids dynamic IP address issues.
User avatar
Ivan
Posts: 258
Joined: January 27th, 2012, 6:37 pm
Location: Belgrade, Serbia

Re: theme changer

Post by Ivan »

good guess jsmorley, wire at work, wireless at home.

btw jsmorley, can you check my rotator problem so i do not spam this theme with it.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: theme changer

Post by jsmorley »

Ivan wrote:good guess jsmorley, wire at work, wireless at home.

btw jsmorley, can you check my rotator problem so i do not spam this theme with it.
Sorry, I have never really messed with Rotator much.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: theme changer

Post by jsmorley »

Here is a first pass at one approach. I suspect this could be cleaned up and made a bit more glamorous, but as far as I can tell it works.

Skin IPThemeChanger.ini:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
CurrentIP=72.205.25.120

[MeasureIPWeb]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
ErrorString=-1
UpdateRate=-1
FinishAction=!CommandMeasure MeasureLuaScript "CheckIP();"

[MeasureLuaScript]
Measure=Script
ScriptFile=IPThemeChanger.lua
UpdateDivider=-1

[DummyMeter]
Meter=String
IPThemeChanger.lua in the same folder:

Code: Select all

PROPERTIES =
{

}

function Initialize()

	msMeasureIPWeb = SKIN:GetMeasure('MeasureIPWeb')
	sCurrPath = SKIN:GetVariable('CURRENTPATH')
	sIniFile = SKIN:GetVariable('CURRENTFILE')
	sProgram = SKIN:GetVariable('PROGRAMPATH')

end

function Update()

	return 1
	
end

function CheckIP()

	MyFile = io.open(sCurrPath..'IPThemeChanger.cfg', 'r')
	if not MyFile then
		iErrorCond = 1
		print('IPThemeChangere.ini - Can\'t open file IPThemeChanger.cfg')
	else
		iErrorCond = 0
		tConfigs = {}
		while true do
			sLine = MyFile:read()
			if sLine == nil then break end
			table.insert(tConfigs, sLine)
		end
	end
	io.close(MyFile)
	
	sIP = msMeasureIPWeb:GetStringValue()
	sCurrent = SKIN:GetVariable('CurrentIP')
	
	if iErrorCond = 0 then
		if sIP ~= sCurrent then
			for i = 1, #tConfigs do
				sLeft = string.match(tConfigs[i], '(.*)=')
				if sLeft == sIP then
					sRight = string.match(tConfigs[i], '=(.*)')
					SKIN:Bang('!WriteKeyValue Variables CurrentIP '..sLeft..' \"'..sCurrPath..sIniFile..'\"')
					SKIN:Bang('!Execute [\"'..sProgram..'SkinInstaller.exe\" /LOADTHEME '..sRight..']')
					break
				end	
			end
		end
	end	

end
IPThemeChanger.cfg in the same folder:

Code: Select all

72.205.25.120=JSMeter
127.13.105.20=Enigma
-Set up your different themes as you like, saving them with the "Theme" panel in Manager. Make sure you have this skin loaded in each of them when you save them. It needs to be loaded with every theme, but once loaded it will either change the theme and go to sleep, or just never wake up. It won't take any resources to speak of when in idle mode.

-In IPThemeChanger.cfg you put in a list of "IP=ThemeName" pairs. As many as you like / need.

- Now when you start Rainmeter, this skin will load and will check your IP address. If it is different than what is set in the [Variable] CurrentIP in the skin it will find the theme that matches the actual IP address of your system, change that CurrentIP variable to the matching IP address so we avoid an endless loop, and finally loads the matching theme into Rainmeter.

I'm glad to answer any questions you might have. I know this is kinda diving into the deep end as your first swimming lesson...