Eskil

Diff
Login

Differences From Artifact [cc5825f616]:

To Artifact [cdf8d26b7f]:


82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

111
112
113
114
115
116
117
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
117







-
+




















-
+







    ArmCatch
    set win [twapi::get_foreground_window]
    if {$win eq ""} {
        #puts "No fg window"
        return
    }
    #puts "Locating windows"
    foreach {x1 y1 x2 y2} [twapi::get_window_coordinates $win] break
    lassign [twapi::get_window_coordinates $win] x1 y1 x2 y2
    set width  [expr {$x2 - $x1}]
    set height [expr {$y2 - $y1}]

    set windows {}
    foreach x [list [expr {$x1 + $width / 4}] [expr {$x1 + 3*$width /4}]] {
        foreach y [list [expr {$y1 + $height / 4}] [expr {$y1 + 3*$height /4}]] {
            lappend windows [twapi::get_window_at_location $x $y]
        }
    }
    set windows [lsort -unique $windows]
    #puts $windows
    after 50 "set ::CatchFromWinWait 1" ; vwait ::CatchFromWinWait
    set capturedData {}
    foreach win $windows {
        clipboard clear
        clipboard append ""
        twapi::set_focus $win
        after 50 "set ::CatchFromWinWait 1" ; vwait ::CatchFromWinWait
        twapi::send_keys ^(ac)
        after 50 "set ::CatchFromWinWait 1" ; vwait ::CatchFromWinWait
        foreach {x1 y1 x2 y2} [twapi::get_window_coordinates $win] break
        lassign [twapi::get_window_coordinates $win] x1 y1 x2 y2
        if {[catch {clipboard get} text]} continue
        if {$text eq ""} continue
        lappend capturedData [list $x1 $text]
    }
    $::diff(wClip1) delete 1.0 end
    $::diff(wClip2) delete 1.0 end
    if {[llength $capturedData] == 0} return