Ticket #1880: nowin.au3

File nowin.au3, 1.7 KB (added by anonymous, 14 years ago)
Line 
1
2
3  Opt("WinTextMatchMode"  , 1)     ;1=complete, 2=quick
4  Opt("WinTitleMatchMode" , 2)     ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
5
6; ----------------------------------------------------------------------------------------
7
8
9  func substr( $x, $str )
10; ----------------------------------------------------------------------------------------
11
12  return stringInStr( $str, $x, 0, 1 )
13
14  endfunc
15
16
17  func IsVisible( $handle )
18; ----------------------------------------------------------------------------------------
19
20  return BitAnd( WinGetState( $handle ), 2 )
21   
22  endfunc
23
24 
25
26; ========================================================================================
27;                                       Main:
28;
29; Syntax:  nowin  str1:str2:str......
30;
31; Effect:  KILL ALL windows containing such a strj in its title.
32;
33; ----------------------------------------------------------------------------------------
34
35  msgBox( 1, 0, "pars= " & $cmdLine(1) )              ;;; AutoIt3 runs on "error in expression", why?
36
37  $par = stringSplit( $cmdLine(1), ":", 1 )           ;;; AutoIt3 runs on "error in expression", why?
38
39  $var = WinList()
40
41  For $i = 2 to $var[0][0] ; = Zahl der Fenster
42
43  For $k = 1 to $par[0]
44
45      msgBox( 1, 0, "par.k = " & $par[$k] )   
46
47      If IsVisible( $var[$i][1] )  then
48
49         If  substr( $par[$k], $var[$i][0] ) AND NOT substr( ".au3", $var[$i][0] )  then 
50
51             msgBox( 1, 0, $par[$k] )
52
53             winKILL($var[$i][1])
54
55         endIf
56
57      endIf
58
59  next
60  next
61
62  msgBox( 1, 0, "DONE" )
63
64; ========================================================================================
65
66   
67