run a program - singleinstance only

Discussion, questions and support.
Post Reply
mecanmeup
Posts: 7
Joined: Jun 29th, ’20, 12:03

Post by mecanmeup » Jul 7th, ’20, 11:54

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.
User avatar
Tom
Posts: 398
Joined: Nov 24th, ’15, 23:39

Post by Tom » Jul 7th, ’20, 19:26

This example runs or activates Firefox (Type; Command):

Code: Select all

IfWinExist, ahk_class MozillaWindowClass
	WinActivate, ahk_class MozillaWindowClass
else
	Run, firefox
return
mecanmeup
Posts: 7
Joined: Jun 29th, ’20, 12:03

Post by mecanmeup » Jul 8th, ’20, 08:07

Thanks, it works to me. :D
Post Reply