Page 1 of 1

run a program - singleinstance only

Posted: Jul 7th, ’20, 11:54
by mecanmeup
Hi,

I have a situation as follows, but not sure how to program it by Fastkeys. Please help. THank you.

(1) assign a shortcut key to open a program
(2) after the shortcut key is pressed,
*) if the program is running, and then it will become the active window
*) if the program is not running, then the program will be running first and then become the active window.

Re: run a program - singleinstance only

Posted: Jul 7th, ’20, 19:26
by Tom
This example runs or activates Firefox (Type; Command):

Code: Select all

IfWinExist, ahk_class MozillaWindowClass
	WinActivate, ahk_class MozillaWindowClass
else
	Run, firefox
return

Re: run a program - singleinstance only

Posted: Jul 8th, ’20, 08:07
by mecanmeup
Thanks, it works to me. :D