Jump to content

Don't take focus when executed compiled CUI script?


Recommended Posts

I'm trying make my compiled script as CUI to be shown on screen when ran (task scheduler or from explorer), but not taking focus.

My initial idea was to relaunch itself with Run() and use @SW_SHOWNOACTIVATE flag, but it didn't work, it still showed focused console window.

Any ideas how it can be achieved?


Thank you.

Link to comment
Share on other sites

before starting the CUI , check which window has the focus $hWndActive = WinGetHandle("[ACTIVE]"),
and after opening your CUI , return the focus to where it was WinActivate($hWndActive )

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

@ioa747 Thanks, it works, but very unreliable. Sometimes it switches to totally different application..

 

14 minutes ago, Nine said:

Show a runable script where we can actually see the issue.


Sure

#AutoIt3Wrapper_Change2CUI=y

sleep(60000)

 

Compile it and run from explorer. The opened console window will be in focus. The expected result: explorer window remains in focus, while console window remains visible on screen

Note, as I mentioned before, this may be run by task scheduler, so any application can be in focus when it's launched.

Edited by VAN0
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   1 member

×
×
  • Create New...