Give Focus to Another Program via scripting

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
arirish
Posts: 93
Joined: 13 May 2008 13:52

Give Focus to Another Program via scripting

Post by arirish »

Is it possible to check whether a specific program is running/open, and give focus to that program?

I can open programs fine, but this little thing has me stuck. Had a look through the help file, and obviously the 'focus' function isn't what I need.

Thanks :)

EDIT: Should this be in the Script Exchange forum? If so, can someone please move it there?

admin
Site Admin
Posts: 66323
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Give Focus to Another Program via scripting

Post by admin »

Currently not possible and not planned. Not a positive answer but an answer. :)

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Give Focus to Another Program via scripting

Post by j_c_hallgren »

Could that other scripting app (AHK) help in this case? I'm not a user of it but have seen others make it work for things that XY couldn't quite do.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Give Focus to Another Program via scripting

Post by zer0 »

admin wrote:Currently not possible and not planned. Not a positive answer but an answer. :)
Just in the context of monitoring a specific program...not even as part of Custom Event Actions (CEA)? To be able to do so would be a blessing for scripting, because so much more can be automated. Just imagine...start a download of an archive of an ISO before going to bed...while you sleep, Zip is downloaded, extracted into a directory, mounted using virtual drive software, launched using silent install switches and, afterwards, ISO is archived off to a storage medium, a clean-up procedure is performed and PC is put into Sleep mode...just in time for you to wake up, make some coffee and start using this newly-installed software...all at a touch of a button :mrgreen:

I acknowledge that not all of the described actions would involve XYplorer (nobody expects XY to do work of 3rd-party tools), but they would do so indirectly by the way of affecting the file system and triggering certain stages of a CEA procedure. With CEAs, the potential is huge and it'd be a shame not to tap its possibilities.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Give Focus to Another Program via scripting

Post by TheQwerty »

zer0 wrote:...just in time for you to wake up, make some coffee and start using this newly-installed software...all at a touch of a button
Hold the phones, why am I the one making the coffee - can't XY do that as well? :P

And yes j_c_hallgren's right, AutoHotkey or AutoIt could easily accomplish this, or NirCmd.exe would be even easier.

arirish
Posts: 93
Joined: 13 May 2008 13:52

Re: Give Focus to Another Program via scripting

Post by arirish »

TheQwerty wrote:
zer0 wrote:...just in time for you to wake up, make some coffee and start using this newly-installed software...all at a touch of a button
Hold the phones, why am I the one making the coffee - can't XY do that as well? :P

And yes j_c_hallgren's right, AutoHotkey or AutoIt could easily accomplish this, or NirCmd.exe would be even easier.
Hmm... thanks to everyone for the answers here. Good to know one way or another.

I do actually have AutoIt, though I haven't worked with it in some time. I'll have a delve about, see if I can figure something out!

Post Reply