Lga Run Box - How to force the focus - Forum

Forum Navigation
You need to log in to create posts and topics.

Lga Run Box - How to force the focus

I'm working on an app where the user can schedule a Run command by typing that command into TextEntry1.
I am using the Run Box available in the lgaDialog plug-in. I have it launching with the contents from [TextEntry1].

A typical Run command would be something like:

%localappdata%/Reader_App

It all works, except the Run Box refuses to grab the focus when it comes up. It appears in the taskbar (not blinking either). So the user will need to click in the taskbar to bring up the box.

Is there a way to make it force the focus on launch?

As an alternative solution I created a VBS file that activates the Run Box via its window title. That works if I run it manually. However, if I load the VBS file in Neo (via Run) it won't work. The same is true when I run an external executable file to activate the Run Box (when run manually that works as well).

Any ideas?

BTW, the whole reason I am using the Run Box approach in the first place is that I don't believe there's another way to send a Run command directly in Neo? Looks like the Neo Run function only supports executable files?

Whats wrong with VN run?

https://winhelp.visualneo.com/Applications.html#RUN

Regards

Hans-Peter

Hi Hans-Peter,

It appears that VN Run will only work if you want to launch applications (exe). If it's anything else, I get:

The system cannot find the file specified

In the above example I want to open up a subfolder of the AppData (special) folder:

%localappdata%/Reader_App

The Run Box also supports regular files, URLs, etc. A total of 300 Run Commands it appears.

That potentially makes the [TextEntry1] variable quite powerful, but as far as I can tell only with the Run Box implemented. Either by calling up the regular Windows Run Box via (Win+r) or using a customized version of it via lgaDialog.

Unless I'm missing something...

 

 

 

Hello,

So you want to open a path in explorer? Then call its exe.

https://stackoverflow.com/questions/3400884/how-do-i-open-an-explorer-window-in-a-given-directory-from-cmd-exe

Regards

Hans-Peter

luishp has reacted to this post.
luishp

Hi Hans,

Not quite, contrary to that approach the Run Box won't require a (detailed) Explorer path path for opening frequently used folders like My Documents, My Pictures etc. Typing a simple "Documents" or "Pictures" into the Run Box will do. You can also type in things like "control" to open up Control Panel, "calc" to open up calculator, "CMD" to open up the prompt, "sndvol" to open Volume Mixer and many many more things.

So it looks like there is no avoiding the Run Box for these kinds of things. Hence my question: How to make it force the focus (behave modular) when it opens....

Update: It turns out that the [TextEntry1] is not actually placed in the Run Box :-(. It just remembered previous contents I manually put in.

So I guess what I'm after is probably not possible at all....

@talker

From the Help file here ... https://winhelp.visualneo.com/PredefinedGlobalVariables.html ...

[CurrentDir]

Contains the current active folder. Use in conjunction with the Run Action to specify an application's working directory. This will become the active directory when the application is launched. For example:

SetVar "[CurrentDir]" "c:\windows"
Run "C:\MyPrograms\MyApp.exe" "" "Normal"

To disable the Run action's use of the working directory, simply set [CurrentDir] to null. For example:

SetVar "[CurrentDir]" ""

Haven't tried it myself, but use of [CurrentDir] might do the trick.

@talker

You can make the desired window active with the zmFunctions plugin (Peter Pavlov).

See the commands zmEnableWindow (for a foreign window) and zmEnableCustomWindow for a CustomWindow.

 

Thanks Vadim, but it turns out that I cannot get the [TextEntry1] contents as the actual contents for the LgaRunbox after all...

Thanks Gaev, that sure is useful to know. I'm not sure though if it will apply in this situation.

Anyway, I got it to work now, but not in a very elegant way. I'm putting  TextEntry1 contents on the clipboard and then launch an external executable file that presses Win+R  to launch the default Win Run Command box. It then presses Ctrl+v to paste clipboard contents and finally ENTER:

SetVar "[Clipboard]" "[TextEntry1]"
Run "[PubDir]Win+r.exe" "" "RunOnce+Hidden" "" ""

Hans-Peter, can your SendKey Plug-in do those last three steps? Pressing Win+R,  Ctrl+v and ENTER? I'd rather not use an external executable for sending these keystrokes...

If so, how would I do that exactly?

Hello,

When I remember right, hpwSendKeys has no support for the WIN key.

And it was made to send key-strokes to windows.

Not sure if the WIN+R dialog is a regular window. (An can be found in the window list)

Regards

Hans-Peter

luishp has reacted to this post.
luishp