Force program to foreground?

All my simple program launch buttons work perfectly except for one: Adobe Lightroom (the latest version and several prior).

After launching LR insists on relinquishing the foreground to DO, both v12 and, previously, on v11.

Is there some kind of modifier to force it to come back to the foreground?

Thanks!

Anyone?

These are simple toolbar buttons which point to exe files: Excel, Photoshop, etc. When I click on the Lightroom button it briefly flashes to the foreground and then DO (or LR) forces it back to the background. The only one that does that.

Make a shortcut to Lightroom and double-click it in File Explorer. Does the same thing happen?

Yes.

I created it in the 'desktop' folder. When I dbl-click the shortcut in explorer the same thing happens. When I do likewise on the actual shortcut on the desktop, no.

Still... I guess there's no way to circumvent this bad behavior and force a program to come back to the foreground?

Thanks for replying, Leo.

It depends a bit on how/why Lightroom is losing the focus and where the focus is ending up. There probably is a tool that will fix it, maybe Autohotkey could, but I don't know for sure.

I would ask Adobe for advice since it seems to be happening no matter what launches it, although it could turn out to be another tool confusing things. Anything that changes how windows behave might be involved.

I'm using Lightroom, too. It doesn't happen here, the focus stays with LR. I'm opening Lightroom using a context menu command, which is set for all images, in the file types group "images".

Thanks.

I've got maybe 20 other buttons for major applications, utilities, etc. and they all work perfectly so it's pretty clear that it's just LR.

This actually began happening a while ago when I was running DO 11 and an earlier version of LR. I thought it was something that went sideways on my machine so I (kind of) ignored it, but now that I've built a completely new PC and reinstalled all software it's still there.

I guess I should first go though all my LR settings. I doubt Adobe would help much. :slight_smile:

I have been having a similar problem with Notepad++, but I guess it is the fault of the hack used to make it replace notepad.exe.

This line is used to open it:
CreateObject("WScript.Shell").Run sCmd, 4, False

I tried changing that numeric argument, as it controls how the program window is displayed on launch, but without success.

Re: Notepad++. In preferences: File Operations - Double-click on files - open unregistered file types... just enter Notepad++ there for files with no extension, for instance.

In addition, you have to run the NP++ setup as an administrator (in case you're running as a limited account) and then verify that it all works in Control Panel (default programs). It's stubborn. But if you get TXT to work this way I've found that it all works (and I've done this on several machines several times).

I find it easier to have a hack in place so I don't have to register Notepad++ at each application that may open unregistered text files.

I just re-read the Run Method documentation and changed that numeric value to 5. Guess I missed it the first time. Hoping this time it will work as intended.

Edit: @Spokes, if you really don't find a fix for the LR opening on the background, you may try to launch it from a script using that run method.