Jump to content

Recommended Posts

Posted

Hi Community,

I have written many small scripts so far which are all used to control a 3rd party software - I would say that I am an average experienced user.

Now I have got the situation that I am not able to start a job (i.e. click on a button of a form) in any way.

Usually it should work using the lines below - but as described it doesn't.

WinWait("Spezielle Installation", "")
Sleep(1000)
ControlFocus("Spezielle Installation", "", "[CLASS:Button; INSTANCE:2]")
ControlClick("Spezielle Installation", "", "[CLASS:Button; INSTANCE:2]")

The form itself is rather simple:

Zwischenablage01.jpg.df1beeb95e9e10e50541189da64c7ee7.jpg

 

Window Info lists the following things:

Zwischenablage02.jpg.0cb4f348c4f0067f009fdb4a66d2da10.jpg

Zwischenablage03.jpg.bea497e8d855e8767ff6f07ed5eeca75.jpg

 

All I want to do is to click the button with the text "Erstellen".

I also tried to move the mouse to the button and send a click:

AutoItSetOption("MouseCoordMode", 1)

MouseMove(Number($X), Number($Y), 20)

WinActivate("Spezielle Installation", "")

MouseClick("left")

 

I noticed that even moving the mouse does not work when i activate the window before moving the mouse ... it seems as if there is a kind of protection.

Does anyone have any advise on that?

 

Posted (edited)

That's how I would try it

Local $hWnd =  WinWait("[CLASS:#32770; TITLE:Spezielle Installation]", "", 10)

If WinExists($hWnd) Then
    WinActivate($hWnd)
    ConsoleWrite("$hWnd=" & $hWnd & @CRLF)
    Local $hCtrl = ControlGetHandle ($hWnd, "", "Button2")
    ConsoleWrite("$hCtrl=" & $hCtrl & @CRLF)
    
    Local $iMsg = ControlClick ($hWnd, "", $hCtrl)
    ConsoleWrite("$iMsg=" & $iMsg & @CRLF)
Else
    ConsoleWrite("! $hWnd NOT Exist" & @CRLF)
EndIf

so that through ConsoleWrite I can understand where it is failing

Edited by ioa747

I know that I know nothing

Posted

 

2 hours ago, ioa747 said:

That's how I would try it

Local $hWnd =  WinWait("[CLASS:#32770; TITLE:Spezielle Installation]", "", 10)

If WinExists($hWnd) Then
    WinActivate($hWnd)
    ConsoleWrite("$hWnd=" & $hWnd & @CRLF)
    Local $hCtrl = ControlGetHandle ($hWnd, "", "Button2")
    ConsoleWrite("$hCtrl=" & $hCtrl & @CRLF)
    
    Local $iMsg = ControlClick ($hWnd, "", $hCtrl)
    ConsoleWrite("$iMsg=" & $iMsg & @CRLF)
Else
    ConsoleWrite("! $hWnd NOT Exist" & @CRLF)
EndIf

so that through ConsoleWrite I can understand where it is failing

this is the outcome:

$hWnd=0x000D0702
$hCtrl=0x0007072A
$iMsg=1

Posted

I see - but the app process does not start ...

it's just working when you physically click the button with the mouse.

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
  • Recently Browsing   0 members

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