Advertisement
deseven

eMailFinder

Mar 12th, 2014
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; check out https://github.com/deseven/pcrefind for more
  2. #name = "eMailFinder"
  3.  
  4. OpenWindow(0,#PB_Ignore,#PB_Ignore,600,400,#name,#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  5. DirSelector = ExplorerTreeGadget(#PB_Any,10,10,190,350,"",#PB_Explorer_AlwaysShowSelection|#PB_Explorer_NoFiles|#PB_Explorer_AutoSort)
  6. FindBtn = ButtonGadget(#PB_Any,10,365,190,25,"Find")
  7. Results = EditorGadget(#PB_Any,210,10,380,380)
  8. Dim Results$(0)
  9. CreateRegularExpression(0,"([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})",#PB_RegularExpression_AnyNewLine)
  10.  
  11. Repeat
  12.   ev = WaitWindowEvent()
  13.   If ev = #PB_Event_Gadget And EventGadget() = FindBtn
  14.     If ExamineDirectory(0,GetGadgetText(DirSelector),"*.*")
  15.       ClearGadgetItems(Results)
  16.       SetCurrentDirectory(GetGadgetText(DirSelector))
  17.       While NextDirectoryEntry(0)
  18.         If DirectoryEntryType(0) = #PB_DirectoryEntry_File
  19.           If ReadFile(0,DirectoryEntryName(0),#PB_File_SharedRead)
  20.             While Not Eof(0)
  21.               Found = ExtractRegularExpression(0,ReadString(0),Results$())
  22.               For i = 0 To Found - 1
  23.                 AddGadgetItem(Results,-1,"[" + DirectoryEntryName(0) + "] " + Results$(i))
  24.               Next
  25.               ReDim Results$(0)
  26.             Wend
  27.             CloseFile(0)
  28.           EndIf
  29.         EndIf
  30.       Wend
  31.       FinishDirectory(0)
  32.     EndIf
  33.   EndIf
  34. Until ev = #PB_Event_CloseWindow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement