Search the Community
Showing results for tags 'sunawt'.
-
I´ve got an already usably working script for entering a reservation in to a Java App, but to give it more than very basic functionality and stability I´m stuck. Is there any way beyond MouseGetCursor and WinActivate, and other than lot´s of Sleep, that I can make this more stable? sometimes there is a popup in the app, which of course the script doesn´t see, and sometimes the script "trips" and enters the wrong data in the wrong field, and that of course causes lots of errors and popups... yes, there´s a "Java UDF" Topic in the example scripts section, but that didn´t work for me, and the development on that seems to have stopped years ago... (unless I´m overlooking another thread somewhere?) A newer thread about, as far as I understand it, automating hard-to-automate controls might be a direction: ?do=embed' frameborder='0' data-embedContent>... Here´s a cut-out of what I´ve built so far: Global $sWinTitle = "OPERA PMS [Version" Global $wHandle = WinGetHandle($sWinTitle) Global $cHandle = ControlGetHandle($wHandle, "", "") #region Parser ;that´s a separate story #endregion #region Entry _BlockWindow() OperaSend("!.") OperaSend($aRES[$ixGuestSurName],2) OperaSend("{TAB}") OperaSend($aRES[$ixGuestFirstName],2) OperaSend("{TAB}") OperaSend("i{ENTER}") OperaSend("!n") ;etc... _unBlock() #endregion Func OperaSend($sSend, $flag = 0) While Not WinActive($wHandle);force the window to be active WinActivate($wHandle) WEnd If $flag = 2 Then ;$flag = 2 send longer strings of text with clipput+paste Do ClipPut("") ClipPut($sSend) Sleep(128) ;seems to be necessary Until @error = 0 Do $x = ControlSend($wHandle, "", $cHandle, "^v");{CTRLDOWN}{CTRLUP} Until $x = 1 Sleep(128) Else ;flag = 1 Sends Raw, $flag = 0 Sends "normal" Do $x = ControlSend($wHandle, "", $cHandle, $sSend, $flag) Until $x = 1 Sleep(64) EndIf Do Sleep(8) Until MouseGetCursor() = 2 ;check for non-arrow mouse cursors (busy, etc.) Sleep(8) EndFunc ;==>OperaSend #include <Misc.au3> ; for MouseTrap Function Func _BlockWindow() $pos = WinGetPos($wHandle) If IsHWnd($wHandle) Then WinActivate($wHandle) WinSetState($wHandle, "", @SW_DISABLE) WinSetTrans($wHandle, "", 255 * 0.92) _MouseTrap($pos[0] + 10, $pos[1] + 32) _BlockKeys(1) ConsoleWrite("Blocked" & @CR) $blocked = 1 EndIf EndFunc ;==>_BlockWindow Func _unBlock() If IsHWnd($wHandle) Then _BlockKeys() _MouseTrap() WinSetTrans($wHandle, "", 255) WinSetState($wHandle, "", @SW_ENABLE) ConsoleWrite("Unblocked" & @CR) $blocked = 0 EndIf EndFunc ;==>_unBlock Func _BlockKeys($flag = 0);instead of _BlockInput(), because no Admin privileges If $flag = 1 Then HotKeySet("{TAB}", "_BlockKeysDummy") HotKeySet("^{TAB}", "_BlockKeysDummy") HotKeySet("!{TAB}", "_BlockKeysDummy");doesn´t really work HotKeySet("+{TAB}", "_BlockKeysDummy") HotKeySet("#{TAB}", "_BlockKeysDummy") HotKeySet("{ENTER}", "_BlockKeysDummy") ;...etc. Else HotKeySet("{TAB}") HotKeySet("^{TAB}") HotKeySet("!{TAB}");doesn´t really work HotKeySet("+{TAB}") HotKeySet("#{TAB}") HotKeySet("{ENTER}") ;...etc. EndIf EndFunc ;==>_BlockKeys