Sign in to follow this  
Followers 0
failedtocompile

need help Winactivate, controlfocus

5 posts in this topic

Hello everyone :)

I am having problem trying to WinActivate & or ControlFocus.

I'm launching a old application which then connects to a unix box prompting for credentials

When I use Au3Info.exe and freeze over the window this is what i get:

>>>> Window <<<<

Title:

Class: KEA!

Position: 290, 153

Size: 815, 624

Style: 0x14CF0000

ExStyle: 0x00000110

Handle: 0x00160B86

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x00060A2C

>>>> Mouse <<<<

Position: 792, 167

Cursor ID: 0

Color: 0xF4F4F4

>>>> StatusBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Now i have been searching forums for past 2hrs trying different methods to focus on the window and then Send($userName) etc...

checked helpfile but I am unable to resolve.

Example below of my script:

$Username = InputBox("username", "please enter username")
$pwd = InputBox("password", "please enter username")
$topasfile = "\\server\KEAVT.EXE \\server\userall\test.ktc"
;$appname = "kevt.exe" been testing with this
;$appHandle = WinGetHandle($appname, "")  Been testing with this


RunWait($topasfile)
;WinActivate (HWnd($handle)) been testing with this
;WinActivate("[Class:KEA!]") been testing with this
Send($Username)
sleep(1000)
send("{ENTER}")
sleep(1000)
Send($pwd)
send("{ENTER}")
sleep(2000)
Send("1")
send("1")

Have also tried ControlFocus but what to put in that I don't know as there is no title window. when i launch Windows Windows Program manager it shows the process when i launch sysinternals it does not, very odd.

The program in question is from Attachmate KEA 340 very old app but does the job. I can launch the application fine just not focus on the window and then send keys to it.

To give you an idea the application is like a paid version of Putty but created back in the early 90s

Is there another method, I thougth of trying to get the running process but even sysinternals "find windows process" cant match it to a running task

Thanks in advance

FTC

Share this post


Link to post
Share on other sites



First of all $handle is not defined, it should be $appHandle

Next you can use a mouseClick to focus the keyboard input, or try ControlFocus or ControlClick with coordinate if you don't know its ID. Normally you can get the ID with ControlGetFocus()

ControlFocus($hwnd,'','[X:123\;Y:456\]')

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

First of all $handle is not defined, it should be $appHandle

Next you can use a mouseClick to focus the keyboard input, or try ControlFocus or ControlClick with coordinate if you don't know its ID. Normally you can get the ID with ControlGetFocus()

ControlFocus($hwnd,'','[X:123\;Y:456\]')

$apphandle is in my script and i have experimented with ControlFocus etc... to no avail

Coords works from computer to computer with different screen settings?

Edited by failedtocompile

Share this post


Link to post
Share on other sites

just use whats actually displayed in KEA as the titlebar, i've had this happen in the past

where the title remains blank.

winactivate("KEA")

Share this post


Link to post
Share on other sites

just use whats actually displayed in KEA as the titlebar, i've had this happen in the past

where the title remains blank.

winactivate("KEA")

Sorry about the late reply.

I tried with winactivate("KEA")

I also thought id be trixy >_< and do a wingettitle then output that to a msgbox so i could get the specific title of the window.

What i found was the main issue was Runwait($application) does not work correctly for what ever reason with the KEA application in my specific environment. So just tried Run($application) along with winactivate and controlfocus and now it works.

Cheers

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  
Followers 0