Ktulu789

Unison automation

3 posts in this topic

#1 ·  Posted (edited)

I am using Unison for a scheduled backup. When it finishes the window shows "Synchronization complete" in the status bar. I want to wait until that and close the window but the window shows no text nor controls.

This is all I get with AU3Info

Title:    Unison [default]
Class:    gdkWindowToplevel

How can I automate this?

Edited by Ktulu789

AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

Share this post


Link to post
Share on other sites



#2 ·  Posted

Some automation tasks are more difficult, especially if you can't see the controls. There isn't much you can do but you should be able to get the window position using the title. If the size and layout of the GUI doesn't change, then you could send mouse clicks to predetermined coordinates after mapping out the control positions manually. A more complicated method (you might be able to use for a limited set of controls) would be to search the screen area for a specific identifiable colour, or colour change. The last method is probably the least reliable or efficient.

Share this post


Link to post
Share on other sites

#3 ·  Posted

Hi! Thanks Czardas for your reply!

Sadly the size and layout are static.

I don't need to click anything specific, just wait some hours for the backup to finish. A simple WinClose should do the trick.

The problem is how to know that the status bar says "Synchronization complete" and not "errors or something else" so the colors wont work either. If there are errors I don't want to close the window.

I have found this topic earlier but couldn't get anything from it: 

In the topic somebody points to a chinese topic with a script, in the last reply Wakillon "translated" the script to english (just the annotations), let me quote:

#include <WinAPIEx.au3>
#include <WinAPI.au3>

Local $a,$HSEd1
$a = WinGetHandle ( "[CLASS:gdkWindowChild]" ) 
$HSEd1 = _WinAPI_GetDlgItem ( _SMain ( ), 1032 )
MsgBox ( 8192 + 64, "Window Handle", $HSEd1, 20 )

Func _SMain ( )
    Local $aWindows, $i, $text, $text1, $text2, $PHWnd
    $aWindows = _WinAPI_EnumChildWindowS ( $a, 0 )  ; find masked window
    For $i = 1 To UBound ( $aWindows ) - 1
        $text = $aWindows[$i][0]                    ; Window Handle
        $text1 = $aWindows[$i][1]                      ; Window Class
        $text2 = WinGetTitle ( $aWindows[$i][0] )      ; Window Title
        If $text <> "" And $text1 = "Static" And $text2 = "Control title" Then
            $PHWnd = _WinAPI_GetParent ( $text )
            Return $PHWnd                          ; Return to find order in the parent window handle
        EndIf
    Next
EndFunc ;==> _SMain ( )

When I tried the _WinAPI_EnumChildWindowS I got no array and no error so I'm stuck O.o


AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

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