Jump to content

Control Send Hidden Window


Go to solution Solved by crashnburn,

Recommended Posts

Hello! I work at a dealership and I am trying to create a script for our Dealer Management System. If one of my users is viewing customer information and they let the computer time out, it locks the customer, this happens a lot. I am trying to create a script that will log into the system as an admin and unlock it so I don't have to every time this happens. The problem I am running into is that the CLASSNN changes every time the program opens and it will not send the log in information to the program. If I manually enter the CLASSNN every time it works fine, but this is impractical and defeats the purpose of the program. This is what I am testing to get it to work but I have had no luck.

ShellExecute("IDS.lnk", "", @ScriptDir)
Sleep(2000)
$handle = WinGetHandle("AccuTerm 2K2 - [IDS (1)]")
ControlSend("AccuTerm 2K2 - [IDS (1)]", "", $handle, "username", 1)

For testing purposes I have not tried to hide it yet, but I still cannot get it to send keys to the window. I have searched through tons of posts regarding similar issues but I have had no luck getting it resolved. Can someone please point me in the correct direction. Thank you!

 

Link to comment
Share on other sites

use controlsettext, requries you to define the control you set, seems you are posting the window handle as the control handle, which won't fly.

edit: use the windowinfo tool, on your control, and copy the summary tab's data back in.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

  • Solution

Thank you jdelaney for your reply. I tried controlsettext but it did not work. On the bright side I did get it working. I used:

$class = WinGetClassList("[CLASS:ThunderRT6MDIForm]", "")
$string = StringSplit($class, @CRLF)

At first it still was not working, but after some troubleshooting I noticed the CLASSNN that was produced was missing a "1" at the end of it. So I rewrote my control code to:

ControlSend($handle, "", $string[48] & "1", "username")

and everything seems to be working now.

Link to comment
Share on other sites

That will work, but if additional classes (aka, controls) are ever added to the window, your script will (probably) break.

If the 'id' of the control is visible, use that, instead...it will probably stay stagnant.

also, sends are flakey, controlsettext is more reliable.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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   0 members

    • No registered users viewing this page.
×
×
  • Create New...