Advertisement
Crys

crys_cmini_info()

Apr 2nd, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.18 KB | None | 0 0
  1. ; Bestimmt die Eigenschaften aller ofener Fenster
  2. Func crys_cmini_info()
  3.     $aWL = WinList()
  4.     $anzahl = 14
  5.     ;dim $liste[$aWL[0][0]][$anzahl]
  6.     dim $liste[1][$anzahl]
  7.     ;_ArrayDisplay($aWL, "WinList()")
  8.     ;exit
  9.    
  10.     $liste[0][0] = "Fenstertitel"
  11.     $liste[0][1] = "Fenster-ID"
  12.    
  13.     $liste[0][2] = "Pos-x"
  14.     $liste[0][3] = "Pos-y"
  15.     $liste[0][4] = "Breite"
  16.     $liste[0][5] = "Höhe"
  17.    
  18.     $liste[0][6] = "existiert"
  19.     $liste[0][7] = "sichtbar"
  20.     $liste[0][8] = "freigegeben"
  21.     $liste[0][9] = "aktiv"
  22.     $liste[0][10] = "minimiert"
  23.     $liste[0][11] = "maximiert"
  24.    
  25.     $liste[0][12] = "Monitor 1"
  26.     $liste[0][13] = "Monitor 2"
  27.    
  28.     ;if $debug = 1 then _ArrayDisplay(_GetMonitorInfo(), "_GetMonitorInfo()")
  29.     $mon = _GetMonitorInfo()
  30.     dim $monitor[$mon[0][0]+1][4] = [["x-start", "y-start", "x-breite", "y-höhe"]]
  31.     for $x = 1 to $mon[0][0]
  32.         $monitor[$x][0] = $mon[$x][2]
  33.         $monitor[$x][1] = $mon[$x][3]
  34.         $monitor[$x][2] = $mon[$x][0]
  35.         $monitor[$x][3] = $mon[$x][1]
  36.     next
  37.     if $debug = 1 then _ArrayDisplay($monitor, "Bildschirm Abmasse:")
  38.    
  39.     For $i = 1 To $aWL[0][0]
  40.         $name = $aWL[$i][1]
  41.         $size = WinGetPos($name)
  42.         if IsArray($size) = 0 then
  43.             MsgBox(16, $name, "WinGetPos() ist kein Array!")
  44.             exit
  45.         endif
  46.         ;MsgBox(0, $name, "Die Koordinaten des aktuellen Fensters lauten (x, y, Breite, Höhe):" & @CR & $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
  47.        
  48.         $status_id = WinGetState($aWL[$i][1], "")
  49.         $status = ""
  50.         dim $status_wert[6]
  51.         dim $wert[6] = [1,2,4,8,16,32]
  52.         dim $werte[6] = ["existiert", "sichtbar", "freigegeben", "aktiv", "minimiert", "maximiert"]
  53.         for $n=5 to 0 step -1
  54.             if $status_id-$wert[$n] >= 0 then
  55.                 $status_id = $status_id-$wert[$n]
  56.                 ;$status = $status & " " & $werte[$n]
  57.                 $status_wert[$n] = 1
  58.             endif
  59.         next
  60.  
  61.         ; Fenster muss eine Größe haben und einen Titel
  62.         if ($size[2]*$size[2]) > 0 and $aWL[$i][0] <> "" then
  63.             ; Fenster muss sichtbar sein
  64.             if $status_wert[1] = 1 then
  65.                 ; Ausnahmen definieren
  66.                 if $aWL[$i][0] <> "Start" and $aWL[$i][0] <> "Program Manager" and $aWL[$i][0] <> "AMD:CCC-AEMCapturingWindow" then
  67.                     $y = UBound($liste)
  68.                     ReDim $liste[$y+1][$anzahl]
  69.                    
  70.                     $liste[$y][0] = $aWL[$i][0]
  71.                     $liste[$y][1] = $aWL[$i][1]
  72.                    
  73.                     $liste[$y][2] = $size[0]
  74.                     $liste[$y][3] = $size[1]
  75.                     $liste[$y][4] = $size[2]
  76.                     $liste[$y][5] = $size[3]
  77.                    
  78.                     $liste[$y][6] = $status_wert[0]
  79.                     $liste[$y][7] = $status_wert[1]
  80.                     $liste[$y][8] = $status_wert[2]
  81.                     $liste[$y][9] = $status_wert[3]
  82.                     $liste[$y][10] = $status_wert[4]
  83.                     $liste[$y][11] = $status_wert[5]
  84.                    
  85.                     $ueberhang = 8 ; Was maximierte Fenster auf den anderen Bildschirm überhängen
  86.                     for $x = 1 to $mon[0][0]
  87.                         if $size[0] >= $monitor[$x][0]-$ueberhang and $size[0]+$size[2] <= $monitor[$x][0]+$monitor[$x][2]+$ueberhang then
  88.                             $liste[$y][11+$x] = 1
  89.                         endif
  90.                         ;MsgBox(0, "monitor "&$x+1, $size[0] & " >= " & $monitor[$x][0]&" - "&$ueberhang&" and "&$size[0]&" + "&$size[2]&" <= "&$monitor[$x][0]&" + "&$monitor[$x][2]&" + "&$ueberhang )
  91.                     next
  92.                 endif
  93.             endif      
  94.         endif
  95.     Next
  96.    
  97.     if $debug = 1 then _ArrayDisplay($liste, "Liste der relevanten offenen Programme:")
  98.     return $liste
  99. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement