ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó¥Îvba°õ¦æºô­¶¿ï¾ÜÀɮתº¥\¯à?

[µo°Ý] ¦p¦ó¥Îvba°õ¦æºô­¶¿ï¾ÜÀɮתº¥\¯à?

ºô§}:
  1. https://www.pinkoi.com/
½Æ»s¥N½X
³o­Óºô¯¸¥i¥Hª½±µ¥Îfbµn¤J
µù¥U¤§«á·|¦³«H¥ó,¥´¶}«H¥ó¦³­Ó¦a¤è¥i¥H¿ï¾ÜÀɮצp¹Ï¤ù

¦p¦P³Â»¶®a±Úªºªþ¥óªº¿ï¾ÜÀɮפ]¬O¤@¼Ë,«ö¤U¥h¤§«á³£·|°±¤î°Ê§@,°£«D¤â°ÊÃö³¬¸Óµøµ¡,½Ð°Ý¦³¦p¦ó¸Ñ¨M³o­Ó°ÝÃD©O?

¦ýµ{¦¡¤@¥¹.Click ³o­Ó¿ï¾ÜÀɮתº«ö¶s¤§«á´NµLªk°Ê§@¤F
¥²¶·­n¤â°ÊÃö³¬¸Óµøµ¡¤~¥i¥HÄ~Äò°Ê§@
½Ð°Ý­n¦p¦ó¸Ñ¨M³o­Ó°ÝÃD©O?

PS:³\¦hºô¯¸³£¦³¬Û¦Pªº³o­Ó°ÝÃD,ÁٽЦU¦ì¤j¤jÀ°¦£¸Ñ¨M
PKKO

  1. Sub test()
  2. 'PS:­n¦Û¤v¥ý¥Îie¶}±Òhttps://www.pinkoi.com/ºô§}
  3. '¨Ã¥B¥ÎFBÂI¿ïµn¤J,¤£µM¤U¦C»yªk±N·|§ä¤£¨ì¶Ç°e°T®§ªº³¡¤À,­n¦³µn¤J¤~¥i¶Ç°e°T®§µ¹§O¤H
  4. Set IE = CreateObject("InternetExplorer.Application")
  5. IE.Visible = True
  6. IE.Navigate "https://www.pinkoi.com/user/testpkko"
  7. Do While IE.Busy Or IE.readyState <> 4: DoEvents: Loop
  8. With IE.Document
  9.     i = 0: On Error Resume Next
  10.     For Each E In .GetElementsByTagName("A")
  11.         A = E.Text
  12.         If CStr(A) = "¶Ç°e°T®§" Then
  13.             E.Click '³oÃä©I¥s¥X¶Ç°e°T®§ªºµøµ¡
  14.             '­n¦p¦ó±±¨î¸Óµøµ¡¿é¤J¥D¦®+¤º¤å+¿ï¾ÜÀɮשO?
  15.             
  16.             Call WEB_DETAIL(IE) '§Ú¥Îºô­¶¤¸¯Àªº³¡¤ÀµLªk¬d¤£¥X¬ÛÃö¸ê°T
  17.         End If
  18.     Next
  19. End With
  20. End Sub
½Æ»s¥N½X
  1. Sub WEB_DETAIL(IE)
  2. With IE
  3.     Do While .Busy Or .readyState <> 4: DoEvents: Loop
  4.     With .Document
  5.         i = 0: On Error Resume Next
  6.         For Each E In .ALL
  7.             i = i + 1
  8.             Cells(i, "a") = E.tagname
  9.             Cells(i, "b") = E.ID
  10.             Cells(i, "c") = E.Name
  11.             Cells(i, "d") = E.Value
  12.             Cells(i, "e") = E.innertext
  13.             Cells(i, "f") = E.Type
  14.             Cells(i, "g") = E.href
  15.             Cells(i, "H") = E.Text
  16.         Next
  17.     End With
  18. End With
  19. End Sub
½Æ»s¥N½X
PKKO

TOP

¥»©«³Ì«á¥Ñ PKKO ©ó 2017-1-5 15:01 ½s¿è

§Ú¤w¸g§â§¹¾ãªºµn¤Jµ{¦¡½X¥H¤Î¸õ¥Xªí³æªºµ{¦¡½X³£§¹¦¨
¦ý¬O­n¦p¦ó¤~¯à°÷±N¸õ¥Xªºªí³æ¿é¤J¥D¦®©M¤º¤å¥H¤Î¿ï¾ÜÀɮרåB±H¥X¸ê®Æ©O?
  1. Sub test()
  2. Dim ie As Object 'SHDocVw.InternetExplorer
  3. Set ie = CreateObject("InternetExplorer.Application")
  4. Call login(ie) 'just for login
  5. Call show_the_form(ie) 'My problem in here
  6. End Sub
  7. Sub login(ie)
  8. ie.Visible = True
  9. ie.Navigate "https://www.pinkoi.com/user/testpkko"
  10. Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop


  11. Dim anchorTags As Object 'MSHTML.IHTMLElementCollection
  12. Set anchorTags = ie.document.GetElementsByTagName("A")

  13. Dim oAnchorLoop As Object 'MSHTML.IHTMLAnchorElement
  14. For Each oAnchorLoop In anchorTags
  15.     Dim anchorText As String
  16.     anchorText = oAnchorLoop.Text
  17.     If anchorText = ChrW(20659) & ChrW(36865) & ChrW(35338) & ChrW(24687) Then
  18.         Dim oAnchorLogon As Object 'MSHTML.IHTMLAnchorElement2
  19.         Set oAnchorLogon = oAnchorLoop
  20.         oAnchorLogon.Click
  21.         Exit For
  22.     End If
  23. Next

  24. Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop
  25. '* so now logon form should be visible

  26. On Error Resume Next
  27. Dim oUserNameInput As Object 'MSHTML.IHTMLInputElement
  28. Set oUserNameInput = ie.document.getElementById("n-login-id")
  29. nowtime = Timer
  30. Do While ie.Busy Or ie.readyState <> 4 Or oUserNameInput Is Nothing
  31.     DoEvents
  32.     If Timer - nowtime > 1 Then Exit Do 'Already logoin
  33.     Set oUserNameInput = ie.document.getElementById("n-login-id")
  34. Loop

  35. oUserNameInput.Value = "testpkko"

  36. Dim oUserPassword As Object 'MSHTML.IHTMLInputElement
  37. Set oUserPassword = ie.document.getElementById("n-login-password")

  38. oUserPassword.Value = "abc123"


  39. Dim oListElement As Object 'MSHTML.HTMLLIElement
  40. Set oListElement = oUserNameInput.parentElement

  41. Dim oUnorderedList As Object 'MSHTML.IHTMLUListElement
  42. Set oUnorderedList = oListElement.parentElement

  43. Dim oForm As Object 'MSHTML.IHTMLFormElement
  44. Set oForm = oUnorderedList.parentElement

  45. Dim oSubmitInputElememt As Object 'MSHTML.HTMLInputElement
  46. Set oSubmitInputElememt = Nothing

  47. Dim lFormChildrenLoop As Long
  48. For lFormChildrenLoop = 1 To oForm.all.Length

  49. If oForm.elements.Item(lFormChildrenLoop).Type = "submit" Then
  50.     Set oSubmitInputElememt = oForm.elements.Item(lFormChildrenLoop)
  51.     Exit For

  52. End If

  53. Next lFormChildrenLoop
  54. If Not oSubmitInputElememt Is Nothing Then
  55.     'Stop '* get ready .....
  56.     oSubmitInputElememt.Click
  57.     Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop
  58. End If
  59. End Sub
  60. Sub show_the_form(ie)
  61. Application.Wait Now + TimeValue("00:00:03")

  62. ie.Navigate "https://www.pinkoi.com/user/testpkko2" 'After login we can trip to other people website
  63. Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop
  64. With ie.document
  65. On Error Resume Next
  66. For Each E In .GetElementsByTagName("A")
  67.     a = E.Text
  68.     If CStr(a) = "¶Ç°e°T®§" Then
  69.         E.Click '³oÃä·|¸õ¥X±H°eªºªí³æ,­n¦p¦ó¿é¤J¥D¦®¥H¤Î¤º¤å©M¿ï¾ÜÀɮרëö¤U±H°e«ö¶s©O?
  70.     End If
  71. Next
  72. End With
  73. End Sub
½Æ»s¥N½X
PKKO

TOP

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2017-1-9 02:00 ½s¿è

¨ä¹ê,§Ú¸ò§A¤]¹J¨ì¬ÛÃöªº°ÝÃD

¤£¹L§Ú¬O¹J¨ì­nÃö³¬¼u¥Xªºalertĵ§i

¨S¿ù,¥Ø«e·|¥X²{¨â­Ó°ÝÃD

²Ä¤@­Ó¤]´N¬O§A´£¨ìªº

«ö¤Uclick¤§«á,µ{¦¡´N¥d¤F

ptt¨ºÃä¤]·j¹L¨Sµª®×,¦ý¦³¤@­Ó¤è¦V

¥¿±`¨Ó»¡

·í­n«ö¤Uclickªº¤W¤@¦æ

¦n¹³´N¥ýcall¤F¤@­Óautokey(Ãþ¦ü³sÂIµ{¦¡ªº¥~±¾)
¨Ã¥B¹w©w¤@¬í«á«ö¤Uenter

³o®É«á,­ì¥ýªºµ{¦¡¦^¨ìclick,«ö¤U

µ{¦¡¼u¥Xµøµ¡,¤£°Ê¤F

¬ù¹L¤@¬í«á,autokeyªºµ{¦¡´N·|«ö¤Uenter,´N·|Ä~Äò°õ¦æ

³o­Ó³¡¥÷§Ú¦³²q·Q¹Á¸Õ¤@©Û

´¿¸g¶W¯ÅªO¥D¦³¤À¨É¹L,¨â­Ó¦P®É¤@°_°õ¦æªºvba
http://forum.twbts.com/viewthread.php?tid=6396
§Ú¦b²q´ú³o­Ó³¡¥÷·|¤£·|¦³¿ìªk±aªº¶i¨Ó³B²z


µM«á²Ä¤G­Ó°ÝÃD

§Ú­Ì¥ý©¿²¤±¼«e­±©Ò¦³ªº¨BÆJ

ª½±µ¤â°Ê¶}±Ò¼u¸õµøµ¡

ª½±µ¨Ï¥Î
ie.document.writeln ("<script type=""text/javascript"">window.focus()</script>")
ªº¤è¦¡«ö¤U«ö¶s

½T¹ê«ö¶s¤]«ö¤U¤F

¦ýie¤]·|¦P®É¥d¦º,

³Ì«á¦³­Ó³¡¥÷¥i¥H¸É¥R

¨Ã¤£¤@©w­n¦Û¤v¶}±Ò¤@­Ó·sie
  1.     Set objShell = CreateObject("Shell.Application")
  2.     Set objAllWindows = objShell.Windows

  3. For Each ow In objAllWindows
  4.     If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
  5.         If (InStr(1, ow.LocationURL, "https://www.google.com.tw", vbTextCompare)) Then
  6.            °õ¦æªºµ{¦¡½X
  7.        end if
  8.    end if
½Æ»s¥N½X
¥i¥H¥Îif+·j¯Á§ä¥X¥Ø«e¶}±Òªºie


¨ä¹ê§Ú¤]³Q¼u¥Xªºalert·dªººë¯«¯Ó®z¤F,¦nºG

TOP

¸É¥R¤@¤U
  1. Do While (ow.Busy And errorcount < 5)
  2. errorcount = errorcount + 1
  3. ow.document.writeln ("<script type=""text/javascript"">window.focus()</script>")

  4. 'For i = 1 To 50000
  5. 'Next
  6. 'ow.Visible = False
  7. 'ow.Visible = True
  8. Application.SendKeys ("{Enter}")
  9. Loop
½Æ»s¥N½X
ªº¤è¦¡«ö¤U«ö¶s

TOP

­è§Ú°µ¤F¤@­Ó´ú¸Õ

¥i¯à·|¦³ÂIÀ°§U


±`±`§Ú­Ì¦b´ú¸Õªº®É­Ô

·|¦]¬°ÂI¿ï¤Fexcel

©Ò¥H±Ò¥Îªºµøµ¡´N³Q´«¨ìexcel¤W­±

¤]´N·|Åܦ¨sendkeys ¶]¥hexcel

©Ò¥H§Ú¥Î¤F¤@­Ó¤p³Z¬

µ{¦¡½X¬O¤§«e¶W¯Åª©¥D ³o½g§ì¤U¨Óªº
http://forum.twbts.com/thread-18950-1-3.html
  1. Do While ie.readyState <> 4 Or ow.Busy:
  2.                 DoEvents
  3.                 If ie.Busy Then
  4.                 ie.Visible = False     ''´N¬O±q·sÁôÂèϥεøµ¡
  5.                 ie.Visible = True      ''±µµÛ¤S­«·sÅã¥Üactive¨Ï¥Îµøµ¡
  6.                     ie.document.Focus
  7.                     DoEvents
  8.                     Application.SendKeys "{ENTER}", True   '**«ö¤UÁä
  9.                 End If
  10.             Loop
½Æ»s¥N½X
§ÚÁÙ¦b¬ã¨salert¤¤...

¤£¹L½u¦A°ÝÃD¬O §Ú·|¨Ï¥Î¶WªOªºÂùvba

¦ý§Ú¤£¾å±o«ç»ò§â³ævba call¦¨ Âùvba

TOP

¦^´_ 6# singo1232001


©êºp  §ÚªºÂùvba°õ¦æÁÙ¬O¥d¦í¤F,

²Ä¤@­Ó«e¾Éªº¥¨¶° §Ú³]©w5¬í«á¶}©l
§Ú¥ý«ö¤U¤F²Ä¤@­Ó¥¨¶°
²Ä¤G­Ó®øĵ§iªº¥¨¶° §Ú³]©w10¬í«á¶}©l
§Ú°¨¤W«ö¤U¤F²Ä¤G­Ó¥¨¶°

¦ý¬O±¡ªpÅܦ¨³o¼Ë
0-----------5------------10----------->
>>>>>>>>(«ö¤Uclick´N°±¦í)

²Ä¤@­Óvba¥L¶]¨ìie«ö¤Uclick
ĵ§iµøµ¡¤@¸õ¥X¨Ó,
²Ä¤G­Ó­Ë¼Æ¤¤ªº¥¨¶°¤]¸òµÛ¥d¦í¤F :'(

TOP

¦^´_ 7# singo1232001


    «D±`·PÁ±zªº¦^µª¡A§Ú¨ü¯q¤F¤T­Ó³¡¤À
¤@¡B­ì¨Ó¥i¥H¤£¥Î¨C¦¸³£¶}±Ò·sªºIE,³o­Ó¹ï§ÚÀ°§U«Ü¤j
¤G¡B§Ú¤§«e³£¬O³z¹L¥t¥~¤@­Ó¤èªk±Nºô­¶²¾¨ì³Ì«eºÝ(µ{¦¡½X¸ûªø¡A±zªº¤èªk§ó²³æ¤F)
  1. ie.Visible = False     ''´N¬O±q·sÁôÂèϥεøµ¡
  2.                 ie.Visible = True      ''±µµÛ¤S­«·sÅã¥Üactive¨Ï¥Îµøµ¡
  3.                     ie.document.Focus
½Æ»s¥N½X
¤T¡B­ì¨Ó·í«ö¤U«ö¶sµ{¦¡½X·|µLªk°Ê§@ªº®É­Ô¡A¥t¥~¤@­Ó³]©w®É¶¡±Ò°Êªº¥¨¶°¤]µLªk±Ò°Ê(§Ú­ì¥»¤]­n°µ¹êÅç¤F¡A¬Ù¤U¤F°µ¹êÅ窺®É¶¡)
±zªº°ÝÃD§Ú¤w¸g¬Ý¨ì¥t¥~¤@½g¤å³¹,§Ú°µÂI¹êÅ礧«á¦A¤@°_¦^´_±z!
PKKO

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD