It is currently May 2nd, 2024, 3:27 pm

Bringing a program to front if it is already running?

Get help with creating, editing & fixing problems with skins
LordTyr85
Posts: 2
Joined: January 22nd, 2012, 9:59 am

Bringing a program to front if it is already running?

Post by LordTyr85 »

Hi, I've started using rainmeter after seeing this

http://i.imgur.com/uD1yV.jpg

and set up my desktop almost exactly like it.
I love it, but can't get rid of the taskbar just yet, because when I open Chrome again with the "dock" it just opens a new window, and using alt+tab all the time makes using this too annoying.
It works with skype and itunes, and I use steam so little that it doesn't matter if it doesn't work there. Also, auto-hiding the taskbar is no option because it constantly comes up when i try clicking something at the bottom of a page, like play/pause in grooveshark etc.

Can anyone tell me how i can get chrome to open the same window again? Sorry if there is already a post on this or it's not possible at all, I know the FAQ says rainmeter can't replace the taskbar. I just thought there has to be a way to do it, but I have no idea what to look for.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bringing a program to front if it is already running?

Post by jsmorley »

As far as I know, there is no command line option that you can put on the .exe to cause it to open a new "tab" instead of a new instance of the browser. If there is, it is probably not consistent across different browsers.

However, you can execute an http:// command, which will cause Windows to send the request for the website to the "default" browser. This will in fact be loaded as a new tab in the browser if it is already running, and run the browser if not.

So instead of:

LeftMouseUpAction=!Execute ["C:\Program Files\Chrome\Chrome.exe"]

You could use:

LeftMouseUpAction=!Execute ["http://SomeSite.com/MyHomePage.html"]

That will open your default browser to whatever you want as your "home" page. It will open in a tab if Chrome is running, or in a new instance if not. Caveat, I have not tested this in Chrome, but I use it every day in Firefox, so I'm betting it works the same way in Chrome.

Those are just examples of course. I don't use Chrome and there is no such site. Adjust for where your browser is and what you have defined as your home page.

As for other applications, that is going to be completely dependent on how they work. Some, like Notepad++ will always open a new call to the executable as a tab in an existing instance if it is running, other applications assume you want a new instance. Some application have a setting for "allow more than one instance" or some such, but not many. There is no way Rainmeter can control this.
LordTyr85
Posts: 2
Joined: January 22nd, 2012, 9:59 am

Re: Bringing a program to front if it is already running?

Post by LordTyr85 »

Thanks for the quick reply!

This worked nicely =D
Alex Becherer

Re: Bringing a program to front if it is already running?

Post by Alex Becherer »

you need two different buttons that toggle wether the application is running. you also need Nir Cmdhttp://www.nirsoft.net/utils/nircmd.html.
i am currently using a non-shipped plugin (isrunning.dll) to see wether the application is running, but it probably should be possible with process.dll as well.

Code: Select all

[MeasureChromeIsRunning]
Measure=Plugin
Plugin=IsRunning.dll
ProcName=Chrome
IfEqualValue=0
IfEqualAction=!HideMeter MeterChromeButtonRunning
IfAboveValue=0
IfAboveAction=!ShowMeter MeterChromeButtonRunning

[MeterChromeButton]
Meter=BUTTON
X=410
Y=10
W=60
H=60
ButtonCommand=!Execute ["C:\Users\Alex\AppData\Local\Google\Chrome\Application\chrome.exe"]
Hidden=0

[MeterChromeButtonRunning]
Meter=BUTTON
X=410
Y=10
W=60
H=60
ButtonCommand=!Execute ["C:\Program Files (x86)\NirCmd\nircmd.exe" win activate class "Chrome_WidgetWin_0"]
Hidden=1