Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

ControlSetText Not Working with MDI Form

$
0
0
Tried using ControlSend and it doesn't work, it acts like Send, eg, ignoring the handle.

I have a MDI form with a simple login.  ControlSetText is putting the text in the right textboxes, but the application is not recognizing the text, "password" sould look like "*******" etc.  And the okay button now says {space}

Here is a picture of what it looks like after I run the script.

Posted Image

Any way I can get this ap to recognize the keystrokes?  Far as the program realizes, no text has been entered even though it appears.  For example when I click the Okay button, it says, "You must enter in a user ID." even though it has "user" in the text box.

Here is my code:
#include <_EnumChildWindows.au3>
Local $sMessage = "OKAY"
Local $w, $sContent, $counter, $result
Local $hWnd="",$hControl=0,$sTitle=0,$sClass=0,$aEnumList
$w = Run("S:\PROG\util\proj.exe")
$hWnd = WinWait("PROG", "", 5)
Sleep(5000)
$aEnumList=_EnumChildWindows($hWnd,$hControl,$sTitle,$sClass)
$w = WinWait(get_handle($aEnumList, "proform", 1), "", 5)
Sleep(1000)
$hWin = get_handle($aEnumList, "JYACCmultitext", 1)
ControlFocus($hWin,"","")
Sleep(1000)
ControlSetText($hWin,"","","user")
Sleep(1000)
$hWin = get_handle($aEnumList, "JYACCmultitext", 2)
Sleep(1000)
ControlFocus($hWin,"","")
Sleep(1000)
ControlSetText($hWin, "", "", "password")
Sleep(1000)
$hWin = get_handle($aEnumList, "Button", 1)
Sleep(1000)
ControlFocus($hWin,"","")
Sleep(1000)
ControlSetText($hWin, "", "", "{Space}")
Exit 0

Func get_handle($aList, $sClass, $iIteration)
Local $h
For $i=1 to $aList[0][0]
if $aList[$i][1] = $sClass And $aList[$i][3] = $iIteration Then
	$h = $aList[$i][0]
EndIf
Next
Return $h
EndFunc
; from _EnumChildWindows.au3
;[0]|Handle|Classname|Control ID|Iteration|Title/Text
;[1]|0x001305F2|MDIClient|1|1|
;[2]|0x001D058A|proform|5000|1|USER LOGON
;[3]|0x0011056A|Static|0|1|AZTEC
;[4]|0x00100614|Static|0|2|COURT MANAGEMENT SYSTEM
;[5]|0x00170628|Static|6|3|User ID:
;[6]|0x000B0654|JYACCmultitext|7|1|
;[7]|0x001505A4|Static|8|4|Password:
;[8]|0x002205C2|JYACCmultitext|9|2|
;[9]|0x00130686|Button|10|1|	 &OK
;[10]|0x002F0604|Button|11|2| &Cancel
;[16]|0x002105B4|msctls_statusbar32|59646|1|
;[17]|0x002B05B8|AfxControlBar42s|59419|1|
;[18]|0x000A0682|AfxControlBar42s|59422|2|
;[19]|0x00210606|AfxControlBar42s|59420|3|
;[20]|0x0016062A|AfxControlBar42s|59421|4

|

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>