Jump to content
Sign in to follow this  
steve

Cannot send keys to inactive window

Recommended Posts

I'm running jobs on accounts using Terminal Services. The idea is that the job can continue to run, or kick into action to do something, while the account is disconnected.

When the account is connected, the job works as intended.

When an account is disconnected, all windows appear as inactive and a window does not seem to be able to be made active.

Some windows require me to send {Enter}.

I have read about ControlSetText, but some of the windows have no visible controls (as reported by WinGetClassList)

Is there a way to send input to the window rather than a control?

Any suggestions gratefully received.

Steve

Share this post


Link to post
Share on other sites

ControlSend 
--------------------------------------------------------------------------------

Sends a string of characters to a control.


ControlSend ( "title", "text", controlID, "string" [, flag]

this can send to a minimized window . or even if a window has focud


qq

Share this post


Link to post
Share on other sites

ControlSend 
--------------------------------------------------------------------------------

Sends a string of characters to a control.
ControlSend ( "title", "text", controlID, "string" [, flag]

this can send to a minimized window . or even if a window has focud

<{POST_SNAPBACK}>

Thanks, but the window is not minimized. The account is still logged on, but disconnected. Also, there are no controls in the window. No, I don't know how it was programmed - there's a couple of option buttons and a couple of active command buttons - I want to "select" the default command button.

Share this post


Link to post
Share on other sites

Welcome,

I think the command buttons you are mentioning, are controls?

ControlClick should be able to click the buttons. But if Au3Info cannot see them, then maybe not.

:lmao:

Edit: AutoitMacroGenerator can help with installers.

Edited by MHz

Share this post


Link to post
Share on other sites

Is the script running on the terminal server itself, or on the remote machine?

I assume the server. I would be a little surprised if you could access those windows in that case. And if the user is disconnected, in that case, there would be no access either. Am I getting it?

I might be able to duplicate the issue here.

J


If I am too verbose, just say so. You don't need to run on and on.

Share this post


Link to post
Share on other sites

Yes, the script is running on the server.

I use cmdow (http://www.commandline.co.uk/cmdow/ - not mine) to show info about windows. It shows all inactive when disconnected.

I've just tried clicking on the window using MouseClick. Thanks for the clicking suggestion, but the button controls are not visible. It gave me the idea. The click is absolute - I've run cmdow from the AutoIt script to get the window on top and to a particular position. It looks like the clicking action (of proceeding to the next screen) occurs when I reconnect - I saw the fisrt screen change to the second screen when I reconnected, but I know it should have happened a couple of minutes earlier.

Hmm. Previously, it didn't work as I wanted, but the script job finished.

$cmd = 'cmdow "XX" /top /mov 100 100'

RunWait(@ComSpec & " /c " & $cmd, "", @SW_HIDE)

Is this correct to run inline?

Share this post


Link to post
Share on other sites

$cmd = 'cmdow "XX" /top /mov 100 100'
    RunWait(@ComSpec & " /c " & $cmd, "", @SW_HIDE)

Is this correct to run inline?

<{POST_SNAPBACK}>

The syntax looks correct to me, since you have the commands quoted correctly, but the single quotes will not be passed to RunWait. Most times it's better to just write it in there than use a variable, or use the variable for the "XX" section if thats what truly changes.

RunWait(@ComSpec & ' /c ' & 'cmdow "' & $xx & '" /top /mov 100 100',"",@sw_hide)
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...