Jump to content
Sign in to follow this  

How to deal with custom "Save As" dialog?

Recommended Posts


Hello community!

I need to right click on address control.

Control info -->

>>>> Control <<<<
Class:    ToolbarWindow32
Instance:    3
ClassnameNN:    ToolbarWindow323
Advanced (Class):    [CLASS:ToolbarWindow32; INSTANCE:3]
ID:    1001
Text:    Adres: C:\AutoIt SKRYPTY\raporty
Position:    72, 5
Size:    322, 22
ControlClick Coords:    175, 10
Style:    0x5600B84D
ExStyle:    0x00000000
Handle:    0x0000000000061DEC

The problem is, instance number and ID are dynamic.

Script below is working -->

ControlClick("Zapisywanie jako", "", "[CLASS:ToolbarWindow32; TEXT:Adres: C:\AutoIt SKRYPTY\raporty]", "right")


Text isn't constant neither. Only beginning of the text ("Adres:") is always the same. How to deal with it?

Searched the forum but didn't find an answer...

Share this post

Link to post
Share on other sites

ok, I have found workaround in this topic -->

Now my code looks like below (and it's working) -->

$hKontrolka = _ControlGetHandleByText("Zapisywanie jako", "", "ToolbarWindow32", ".*Adres")

    ControlClick("Zapisywanie jako", "", $hKontrolka, "right")

Func _ControlGetHandleByText($vWinTitle, $vWinText, $sCtrlClass, $sTextRegExp)
    Local $hWin, $hCtrl, $sCtrlText, $i = 0

    $hWin = WinGetHandle($vWinTitle, $vWinText)
    If @error Then Return SetError(1, 0, "") ; Window not found

    If Not IsString($sCtrlClass) Then Return SetError(2, 0, "") ; Invalid class string

    While 1
        $i += 1

        $hCtrl = ControlGetHandle($hWin, "", "[CLASS:" & $sCtrlClass & "; INSTANCE:" & $i & "]")
        If @error Then Return SetError(3, 0, "") ; Control not found

        If StringRegExp(ControlGetText($hWin, "", $hCtrl), $sTextRegExp, 0) Then Return $hCtrl ; Match found
EndFunc   ;==>_ControlGetHandleByText

A pity we have no option in autoit to use "REGEXPTEXT:" in control click...

If you have any ideas how to achieve the same result like above in a simpler way, please don't hesitate to post it here.



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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.