It is currently March 29th, 2024, 10:47 am

Simple Rainmeter Button

Get help with creating, editing & fixing problems with skins
vquy4946
Posts: 8
Joined: March 11th, 2016, 1:06 am

Simple Rainmeter Button

Post by vquy4946 »

I have a simple rainmeter button on my desktop that opens chrome when clicked on.

[Rainmeter]
Update=1000

[MeterLaunch3Image]
Meter=Image
ImageName=#@#Images\Alice_Chrome.png
W=64
H=128
LeftMouseUpAction=["C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"]

However, whenever I click it, a new window of chrome pops up. How can I set it so it brings an existing windows of chrome to the forefront if there is one? Thanks for the help!
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Simple Rainmeter Button

Post by jsmorley »

vquy4946 wrote:I have a simple rainmeter button on my desktop that opens chrome when clicked on.

[Rainmeter]
Update=1000

[MeterLaunch3Image]
Meter=Image
ImageName=#@#Images\Alice_Chrome.png
W=64
H=128
LeftMouseUpAction=["C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"]

However, whenever I click it, a new window of chrome pops up. How can I set it so it brings an existing windows of chrome to the forefront if there is one? Thanks for the help!
Rather than launching the Chrome executable, have it open some website. This assumes that Chrome is your default browser in Windows.

LeftMouseUpAction=["https://MyFavoriteSite.com"]

Then it will launch Chrome if it is not running, and will open the defined site in a new tab in the existing window if it is.

Just running the executable will always open a new Chrome window. As far as I know, there is no command line option that will just "restore" and "give focus" to an existing Chrome window. That would require some addon or plugin that could search for a window title or class by name and use the window "handle" to send messages to do those actions. If that is what you really want, this might help:

https://forum.rainmeter.net/viewtopic.php?p=119592#p119592

Hint: If you do go this route, the measure should look like:

Code: Select all

[MeasureRestoreIt]
Measure=Plugin
Plugin=RunCommand
Parameter="#@#nircmd\nircmd.exe" win activate class Chrome_WidgetWin_1
Do be aware that this approach, with nircmd.exe, it will only restore and give focus to an existing window, it won't launch one if it's not running. For that you need to get a bit more complicated, and use the Process plugin in Rainmeter to see if Chrome is running, launch it with the executable command line if not, and use the RunCommand measure if it is. Which I did in the skin I linked to above.

Chances are, it is far simpler to just call a website of some kind, some home page that you use or google.com or something.
vquy4946
Posts: 8
Joined: March 11th, 2016, 1:06 am

Re: Simple Rainmeter Button

Post by vquy4946 »

Hm.... my problem is that it only works with chrome. If i have disord or steam minimized/running in the background, i cant use the same method. So... the only way to do what I want to do is to install plugins?

(Also, I dont fully understand measures, much less mix them with stuff like plugins :P)
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Simple Rainmeter Button

Post by jsmorley »

vquy4946 wrote:Hm.... my problem is that it only works with chrome. If i have disord or steam minimized/running in the background, i cant use the same method. So... the only way to do what I want to do is to install plugins?

(Also, I dont fully understand measures, much less mix them with stuff like plugins :P)
The problem is that Rainmeter is great for making "launchers", but it can't replace the functionality of the Windows Taskbar. It's not about "minimize" and "restore".
vquy4946
Posts: 8
Joined: March 11th, 2016, 1:06 am

Re: Simple Rainmeter Button

Post by vquy4946 »

Good News! I found a way to maximize a window if it isn't the main window!

This guy: https://forum.rainmeter.net/viewtopic.php?f=18&t=7592
made applications that you can use. They are basically a shortcut around rainmeter's limitations. Props to him :D

All you have to do is call them like you would normally do for a launcher, except you pass it the application you want to open.