It is currently July 27th, 2024, 2:50 pm
Controlling wallpaper engine
-
- Posts: 1
- Joined: May 18th, 2024, 5:16 am
Controlling wallpaper engine
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.
-
- Rainmeter Sage
- Posts: 16423
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Controlling wallpaper engine
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
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
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#"]
-
- Rainmeter Sage
- Posts: 7787
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Controlling wallpaper engine
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
-
- Rainmeter Sage
- Posts: 16423
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Controlling wallpaper engine
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.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
-
- Rainmeter Sage
- Posts: 7787
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Controlling wallpaper engine
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.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.