Juno_okyo

Get all links in website

Nov 7th, 2014
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.55 KB | None | 0 0
  1. ;=> Coded by Juno_okyo (08/11/2014)
  2.  
  3. ; Includes
  4. #include <ButtonConstants.au3>
  5. #include <EditConstants.au3>
  6. #include <GUIConstantsEx.au3>
  7. #include <StaticConstants.au3>
  8. #include <WindowsConstants.au3>
  9. #include <Inet.au3>
  10. #include <Array.au3>
  11. #include <String.au3>
  12. #include <GuiEdit.au3>
  13.  
  14. ; Options
  15. #NoTrayIcon
  16. Opt('WinTitleMatchMode', 2)
  17. Opt('GUIOnEventMode', 1)
  18. Opt('GUICloseOnESC', 0)
  19.  
  20. ; Script Start - Add your code below here
  21. #Region ### START Koda GUI section ### Form=
  22. Global $FormMain = GUICreate("Get all links in website", 464, 381, -1, -1)
  23. GUISetFont(12, 400, 0, "Arial")
  24. GUISetOnEvent($GUI_EVENT_CLOSE, "FormMainClose")
  25. Global $Label1 = GUICtrlCreateLabel("URL:", 5, 10, 39, 22)
  26. Global $Input1 = GUICtrlCreateInput("", 50, 8, 340, 26)
  27. Global $Button1 = GUICtrlCreateButton("GET", 398, 8, 61, 25)
  28. GUICtrlSetOnEvent(-1, "Button1Click")
  29. GUICtrlSetCursor(-1, 0)
  30. Global $Edit1 = GUICtrlCreateEdit("", 5, 45, 453, 328)
  31. GUISetState(@SW_SHOW)
  32. #EndRegion ### END Koda GUI section ###
  33.  
  34. While 1
  35.     Sleep(100)
  36. WEnd
  37.  
  38. Func Button1Click()
  39.     Local $url = GUICtrlRead($Input1)
  40.     If $url = '' Then Return False
  41.  
  42.     GUICtrlSetState($Button1, 128)
  43.  
  44.     Local $source = _INetGetSource($url)
  45.  
  46.     Local $list_url = StringRegExp($source, '<a href="http.+">.+</a>', 3)
  47.     If @error Then Return False
  48.  
  49.     Local $max = UBound($list_url) - 1
  50.     For $i = 0 To $max
  51.         Local $link = _StringBetween($list_url[$i], 'href="', '"')
  52.         _GUICtrlEdit_AppendText($Edit1, $link[0] & @CRLF)
  53.     Next
  54.  
  55.     GUICtrlSetState($Button1, 64)
  56. EndFunc
  57.  
  58. Func FormMainClose()
  59.     Exit
  60. EndFunc
Add Comment
Please, Sign In to add comment