I'm brand new to Directory Opus (as of today). Long time user of many other tools that this tool can aggregate and simplify my life.
It's like drinking from a firehose though. One area I'm moving is my hotkeys from AHK to Directory Opus. Works great, saves me memory. But I can't find a way to say, "if this app is already open, bring to focus instead of new instance."
So bascially saying that I want certain System-Wide Hotkeys to be single instance. I searched around the forums here, but couldn't find the answer.
You can use @ifrunning in simple commands to make them run different things depending on whether another process is running or not (@modifier docs here).
But you would still need a command that you can run which tells the other program to come to the front, which will depend on the program. Some do it automatically or have an argument to make them do it, but some don't have anything to do this via the command line.
Hotkeys can also run JScript and VBScript, which can do more complex things, including activate a window based on its title:
To check if a program is running in VBScript, I use this helper function:
Private Function ProcessIsRunning( wmi, strProcess )
Dim colProcessList
Set colProcessList = wmi.Execquery("Select * from Win32_Process Where Name ='" & strProcess & "'")
If colProcessList.Count > 0 Then
ProcessIsRunning = True
Else
ProcessIsRunning = False
End If
Set colProcessList = Nothing
End Function
Like so:
Dim wmi
Set wmi = Getobject("Winmgmts:")
If ProcessIsRunning(wmi, "dopusrt.exe") Then
Shell.Run """" & OpusDest & "\dopusrt.exe"" /dblclk=off", 1, TRUE
End If
Awesome. I thought about going down the script route, but thought there might be a tick box I missed somewhere. Thank you for the quick response. ~ Vince