Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to delete duplicate windows?
#1
I wrote a function which is to delete duplicate windows with "ABC" in the window text.

It usually works but sometimes the wrong windows are closed (maybe due to spe=0 ? or something else? or coding error? Note I want the function to run as fast as possible)

Is there a simple way to delete duplicate windows quickly with a function?

Thank you in advance

Macro Macro16
Code:
Copy      Help
/ function

ARRAY(str) close
ARRAY(int) a; int i j;str sn sm


win("" "" "" 0 0 0 a)
close.create(a.len)
,

for(i 0 a.len)
,
,sn=""
,sn.getwintext(a[i])
,err
,,out "ERROR getwintext(a[i])"

,for j 0 a.len
,,
,,sm=""
,,sm.getwintext(a[j])
,,err
,,,out "ERROR getwintext(a[j])"
,,,
,,if i<>j and (sn=sm) and (find(sn,"ABC")<>-1) and (close[i]<>"yes")
,,,,
,,,out "duplicate window"
,,,out sn
,,,out sm
,,,close[j]="yes"
,,,

for(i 0 a.len)
,if close[i]="yes"
,,clo a[i]
,,err
,,,out "clo a[i] error"
,,out "duplicate window now closed"

ret


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)