Page 1 of 1

Give Focus to Another Program via scripting

Posted: 24 Oct 2009 23:47
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?

Re: Give Focus to Another Program via scripting

Posted: 28 Oct 2009 15:39
by admin
Currently not possible and not planned. Not a positive answer but an answer. :)

Re: Give Focus to Another Program via scripting

Posted: 28 Oct 2009 15:41
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.

Re: Give Focus to Another Program via scripting

Posted: 28 Oct 2009 16:07
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.

Re: Give Focus to Another Program via scripting

Posted: 28 Oct 2009 16:20
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.

Re: Give Focus to Another Program via scripting

Posted: 28 Oct 2009 21:14
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!