It is currently July 27th, 2024, 2:50 pm

Controlling wallpaper engine

Get help with creating, editing & fixing problems with skins
6Nyx9
Posts: 1
Joined: May 18th, 2024, 5:16 am

Controlling wallpaper engine

Post by 6Nyx9 »

Can someone give me a code for opening and closing an application on a single icon. Since wallpaper engine takes up vram I'd like to toggle it on and off on a click before opening my games.
User avatar
balala
Rainmeter Sage
Posts: 16423
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Controlling wallpaper engine

Post by balala »

6Nyx9 wrote: May 18th, 2024, 5:20 am Can someone give me a code for opening and closing an application on a single icon. Since wallpaper engine takes up vram I'd like to toggle it on and off on a click before opening my games.
Unfortunately more or less this is a skin request, which is not allowed, however I'm gonna give you a tip.
To can not just open, but close as well an app, you need for first a variable, which controls the state of the app. Let's name it State and create it in the [Variables] section. Add it: State=0. I'm gonna control the state of Notepad by this, but obviously you can use it for another app as well.
Opening an app is quite simple, but closing it is a little bit more complicated. To close it you need a RunCommand plugin measure. Add it:

Code: Select all

[MeasureClose]
Measure=Plugin
Plugin=RunCommand
Parameter=taskkill /im notepad.exe
State=Hide
If you want to use this to close another program, you have to replace the notepad.exe parameter of the above Parameter option by the appropriate name.
You need another Calc measure which will control the state of the app. This measure will run the program when the value of the previously introduced State variable is 1 (or above - but it never will be above) and will close when it's 0 or below. So, add this measure:

Code: Select all

[MeasureState]
Measure=Calc
Formula=#State#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasureClose" "Run"]
IfFalseAction=["notepad.exe"]
DynamicVariables=1
Note that it's operating by the value of the State variable.
Finally you need a mouse action which will open and close the associated app. Add it to any meter you want to use to open and close the app: LeftMouseUpAction=[!SetVariable State "(1-#State#)"][!UpdateMeasure "MeasureState"][!UpdateMeter "#CURRENTSECTION#"]
User avatar
Yincognito
Rainmeter Sage
Posts: 7787
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Controlling wallpaper engine

Post by Yincognito »

6Nyx9 wrote: May 18th, 2024, 5:20 am Can someone give me a code for opening and closing an application on a single icon. Since wallpaper engine takes up vram I'd like to toggle it on and off on a click before opening my games.
AFAIK, Wallpaper Engine supports command line parameters, so you could probably "disable" and "enabling" it (or its wallpaper) this way, instead of closing and opening it entirely. See similar thread here:
https://forum.rainmeter.net/viewtopic.php?t=35162#p175573
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16423
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Controlling wallpaper engine

Post by balala »

Yincognito wrote: May 18th, 2024, 11:49 am AFAIK, Wallpaper Engine supports command line parameters, so you could probably "disable" and "enabling" it (or its wallpaper) this way, instead of closing and opening it entirely. See similar thread here:
https://forum.rainmeter.net/viewtopic.php?t=35162#p175573
Good point, however my reply was related to what OP asked: opening and closing an app, by clicking the same meter. I didn't realize there is a Wallpaper Engine app, which has to be enabled or disabled, so maybe my suggestion is not good at all for what should be done. I'll have to wait the OP come back and let us know what is his intention, what he want to do.
User avatar
Yincognito
Rainmeter Sage
Posts: 7787
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Controlling wallpaper engine

Post by Yincognito »

balala wrote: May 18th, 2024, 7:20 pm Good point, however my reply was related to what OP asked: opening and closing an app, by clicking the same meter. I didn't realize there is a Wallpaper Engine app, which has to be enabled or disabled, so maybe my suggestion is not good at all for what should be done. I'll have to wait the OP come back and let us know what is his intention, what he want to do.
Sure thing. Both choices are equally valid, I only referred to the enabling / disabling as an alternative - like Game Mode works for Rainmeter, for example. Opening and closing the application should be perfectly fine as well - it's probably simpler, though it might take some milliseconds more time on a fast machine. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth