09-07-2015, 10:16 AM
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
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
/ 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