LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
processing = 0
again:
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN
wm_click_search:
IF processing == 1 THEN DO
guiwake("ABORT")
guisetctlplacement("Search", , , , , "DISABLE")
RETURN
END
directoryname = ''
DO
err = guifile('directoryName', 'BROWSE|DRIVES', 'Where to find HTML files:')
CATCH SYNTAX
err = CONDITION('D')
END
SELECT err
WHEN "" THEN DO
guiaddctltext("Search", "&Stop")
processing = 1
count = 0
err = gethtmlnames(directoryname, 1)
processing = 0
guiaddctltext("Search", "&Search")
guisetctlplacement("Search", , , , , "ENABLE")
IF err \== "" & err \== "ABORT" THEN guisay(err)
END
WHEN 'DLL function "GUIFILE" reported "Cancel"' THEN NOP
OTHERWISE
CONDITION('M')
END
RETURN
gethtmlnames: PROCEDURE EXPOSE count processing
DO UNTIL err \== ""
err = MATCHNAME(ARG(2), 'name', ARG(1) || '\*.*', 'DSNHCRAT', 'NS')
IF err == "" THEN DO
guigetmsg("CLEAR")
IF EXISTS(guisignal) THEN IF guisignal == "ABORT" THEN RETURN 'ABORT'
IF name.0 == "" THEN DO
err = gethtmlnames(ARG(1) || '\' || NAME, ARG(2) + 1)
IF err \== "" THEN RETURN err
END
ELSE DO
ext = TRANSLATE(FILESPEC('E', name))
IF ext == ".HTM" | ext == ".HTML" THEN DO
count = count + 1
guisendmsg("MyList", "ADDSTRING", , ARG(1) || '\' || name)
END
END
END
END
IF err == 'DONE' THEN err = ""
RETURN err
wm_click_process:
guigetctlvalue("MyList")
guiaddctltext("Search", "Stop")
processing = 1
DO index = 1 TO mylist.0
guigetmsg("CLEAR")
IF EXISTS(guisignal) THEN IF guisignal == "ABORT" THEN RETURN
SAY mylist.index
END
processing = 0
guiaddctltext("Search", "&Search")
guisetctlplacement("Search", , , , , "ENABLE")
RETURN |