02-25-2007, 03:34 PM
This is not complete but you will know how to complete it. This code compares whole data if it match exactly. Maybe you need to find duplicate IPs, i don't know.
;create array for testing
str s1="aaaa 10.123.456.789 bbbb[]aaaa 20.123.456 bbbb[]aaaa 25.123.456.789 bbbb"
ARRAY(str) a
if(findrx(s1 "(10|20|25)(?:\.\d{1,3}){3}" 0 4 a)=0) ret
;int i
;for i 0 a.len
,;out a[0 i]
;ret
;________________________________
int j sheetexists(1) dataexists
;create sheet name from date
str sheet.time("%x")
sheet.replacerx("[\\/]" "-")
;connect to Excel
ExcelSheet es.Init
Excel.Application app=es.ws.Application
;try to connect to today's sheet
es.ws=app.Worksheets.Item(sheet)
err ;;does not exist. create new
,sheetexists=0
,es.ws=app.Worksheets.Add()
,es.ws.Name=sheet
,
if sheetexists
,;get first column and compare with a
,ARRAY(str) a2
,es.GetCells(a2 "A:A")
,if(a2.len=a.len)
,,for(j 0 a.len) if(!(a[0 j]~a2[0 j])) break
,,if(j=a.len) dataexists=1
out "sheet exists=%i, dataexists=%i" sheetexists dataexists ;;debug
;here insert your message box etc
if !sheetexists
,;populate sheet
,for j 0 a.len
,,es.SetCell(a[0 j] 1 j+1)