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

vba±±¨îºô­¶ browser¸I¤Walert°±¦í¤F

vba±±¨îºô­¶ browser¸I¤Walert°±¦í¤F

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

https://login.104.com.tw/login.cfm
(¤W­±¬°104 ¬Y¬Y»È¦æªºµn¤Jºô¯¸)
­è¦n¦bºô¸ô¤W§ä¨ì¤@­Ó¤j®a³£¯à´ú¸Õªººô¯¸(¥D­n§Ú¸I¨ìªºalert¬O¤½¥q¤º³¡ºô¯¸)
©Ò¥H¥Î³o­Ó¨Ó´ú¸Õ
±b¸¹ÀH«K¥´­Ó¿ù»~ªº,Åý¥L¸õĵ§i¨Ó´ú¸Õ(code¤º¤w¦³¶¶«Kkey¤Waaa)

¥H¤Ucode´ú¸Õ¤è¦¡
1.¥ý¥´¶}ie ¨Ã ¶}±Ò³sµ²
2.¥´¶}excel³]©w¤Þ¥Î¶µ¥Ø,©I¥s microsoft internet controls ©M microsoft HTML Object library
3.´ú¸Õcode

ª¬ªp
¥Ø«e³q±`³£·|¦bclick®É.excel´N¾ã­Ó¥d¦í°±¤î¤F,«á­±ªºÂIÀ»µ{§Ç³£¨S¶}©l,alertµøµ¡¥²¶·­nÂI±¼µ{¦¡¤~¦³¿ìªkÄ~Äò¶],(¤£¯àclose,§Ú¤½¥q¤º³¡ªº¤@©w­nÂI¬O)

¥Ø«e¸I¾Àªº«ä¦Ò¤è¦V
1.·Q»¡¬O§_­n¦bclick¥H«e¥ý©I¥svbaÂù¶},¹L­Ó´X¬í¦Û°Êsendkey "enter"  [¤£¹L§Ú´ú¸Õªº®É­Ô,·íie¤@¸õ¥Xalert,¾ã­Óexcel³£°±¦í,¥]§t²Ä¤G­Ósettimerªºsub
2.¦P1,¦ý¬O©I¥sªº¬OÃþ¦ü"¦Û°Ê³sÂIµ{¦¡"ªº¥~±¾(Å¥»¡¦³¤H¦¨¥\,¦ý§Ú¤£À´ªù¹D)
3.·Q»¡¬O¤£¬O¥i¥H¥Î  .document.writeln ª½±µ§â¥Ø«eªº¼È¦sºô­¶ªº"·|­ûµn¤J"µ¹§ï±¼,Åý¥L¤£·|¸õ¥Xalertĵ§iµøµ¡,¦ý¥²¶·¦Aµo¥X·sªº«ü¥O°eµ¹¦øªA¾¹,¬Oªº,¬Ý¯à¤£¯à¶¹L³o­Óĵ§iµøµ¡,³o­Óµøµ¡§Ú§¹¥þ¥Î¤£¨ì
  1. 'Private Declare Function SetFocus Lib "user32" Alias "SetFocus2" (ByVal hwnd As Long) As Long
  2. 'Private Declare PtrSafe Function WinAPISetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As LongPtr) As Long

  3. Sub getALLBrowsersaaa()
  4. On Error GoTo Err_Clear
  5.     Dim mainWorkBook As Workbook
  6.    

  7.    
  8.     Set objShell = CreateObject("Shell.Application")
  9.     Set objAllWindows = objShell.Windows
  10.     Set mainWorkBook = ActiveWorkbook

  11. For Each ow In objAllWindows
  12.     If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
  13.         If (InStr(1, ow.LocationURL, "https://login.104.com.tw/login.cfm", vbTextCompare)) Then
  14.                

  15.     Set HTMLDoc = ow.document
  16.      HTMLDoc.all.id_name.Value = "aaa"    '< -±b¸¹ÀH«K¥´Åý¥L¸õĵ§i
  17. For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
  18.     If MyHTML_Element.Type = "submit" And MyHTML_Element.Value = "·|­ûµn¤J" Then
  19.      
  20.      
  21. '     Call Âù¶}vba  <¥ý¤£¥Î,·Q¶Ç¥hµ¹Sub StartAsub()  SetTimer Application.hWnd, 1, 15000, AddressOf getALLBrowsersaaa>
  22.      MyHTML_Element.Click   <--¶i¤Jie´N¥d¤F
  23. Do While ow.readyState <> 4 Or ow.Busy:
  24.                 DoEvents
  25.                 If ow.Busy Then
  26.                 ow.Visible = False     ''´N¬O±q·sÁôÂèϥεøµ¡
  27.                 ow.Visible = True      ''±µµÛ¤S­«·sÅã¥Üactive¨Ï¥Îµøµ¡
  28.                     ow.document.Focus
  29.                     DoEvents

  30.                     Application.SendKeys "{ENTER}", True   '**«ö¤UÁä
  31.                 End If
  32.             Loop
  33. : Exit For
  34.      End If
  35.     Next



  36.     End If
  37. End If
  38.         
  39.     Next
  40. Err_Clear:
  41. If Err <> 0 Then
  42. Err.Clear
  43.     Resume Next
  44. End If

  45. '    Call StopAsub  <¥ý¤£¥Î,·Q¶Ç¦^¥hStopAsub()   killtimer>
  46. End Sub
½Æ»s¥N½X

¦^´_ 8# stillfish00


    ¤F¸Ñ,«D±`·PÁÂ!
PKKO

TOP

¦^´_ 7# PKKO
·Q½Ð±Ð¤@:³o­Ó»yªk¾A¥Î©ó©Ò¦³ºô¯¸ªº³æ¤@½T»{µøµ¡¶Ü?

¥¼¥²¡A¬Ýºô¯¸¬O¥Î­þºØ¤èªk¼u¥Xµøµ¡¡A·íµM§A¤]¥i¯à¬Ý¤£¥X¨Ó¥L¬O¥Î­þºØ¤èªk
¥D­n¬O alert µøµ¡·|ªý¾×§Aªºµ{¦¡¤U¤@¨B°õ¦æ¡A¤SÆZ±`¨£ªº¡A
³oÃä¥u¬O²q´ú¥¦¥Î alert ¤èªk¼u¥Xµøµ¡¡AµM«á
¹ï§A¦Û¤v«Øªº ie ¤¸¥ó¡A¼È®É©Ê¦a»\¹L­ì¥»ªºalert°Ê§@¦Ó¤w


·Q½Ð­°¤G:­Y¬O¦³¬O©Î§_ªºµøµ¡©O?¥H¤Î¿ï¾ÜÀɮתºµøµ¡©O?¦³¿ìªk³B²z¶Ü

¦³¬O©Î§_ªºµøµ¡ ±À´ú¬O¥Î confirm ¨Ó²£¥Íªº
http://www.w3schools.com/js/js_popup.asp
¥i¥H¥ÎÃþ¦ü¤èªkªw»s¡A¦ý­n¦^¶Ç true ©Î false

¿ï¾ÜÀɮתºµøµ¡¡A³q±`¬O­n¤W¶ÇÀɮקa
³o§Ú¤£¼ô¡Aºô­¶Â^¨ú«Ü¤Ö°µ¨ì¤W¶ÇÀɮתº
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 5# stillfish00


    S¤j¤j,¦n¯S§Oªº¤è¦¡
·Q½Ð±Ð¤@:³o­Ó»yªk¾A¥Î©ó©Ò¦³ºô¯¸ªº³æ¤@½T»{µøµ¡¶Ü?
·Q½Ð­°¤G:­Y¬O¦³¬O©Î§_ªºµøµ¡©O?¥H¤Î¿ï¾ÜÀɮתºµøµ¡©O?¦³¿ìªk³B²z¶Ü
PKKO

TOP

§Ú«á¨Ó¦³µo²{¨ì¤@­Ó²{¶H

§Ú»{¬°wscript ³Ì«á»Ý­n¼g¥X¤@­ÓÃö³¬ªº¥¨¶°

¤£¾å±o¬O¤£¬O¬O=nothing

§Ú¦b¹q¸£µ{¦¡ºÞ²z­û¤¤µo²{

«á¥x³£¨SÃö°_¨Ó ¶V¶}¶V¦h

¹q¸£ÅܺC

¬O§_¦³¬Û¦Pªºª¬ªp

TOP

¦^´_ 1# singo1232001
´£¨Ñ¥t¤@ºØ¶¹L alert µøµ¡ªº¤èªk
Sub test()
    Dim x
    Dim oie As Object: Set oie = CreateObject("internetexplorer.application")
    With oie
        .Visible = True
        .Navigate "https://login.104.com.tw/login.cfm"
        Do While .readystate <> 4 Or .busy: DoEvents: Loop
        .Document.getelementByid("id_name").Value = "aaa"
        For Each x In .Document.getElementsByTagName("input")
            If x.Type = "submit" And x.Value = "·|­ûµn¤J" Then
                With .Document.parentWindow
                   .execScript "window.nativeAlert = window.alert"   'Àx¦s­ì©lªºalert
                    .execScript "window.alert = function() {}"    'Âмgalert function
                    x.Click
                    .execScript "window.alert = window.nativeAlert"   'ÁÙ­ì­ì©lªºalert
                End With
                Exit For
            End If
        Next
        Do While .readystate <> 4 Or .busy: DoEvents: Loop
        .Quit
    End With
End Sub
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¥»©«³Ì«á¥Ñ PKKO ©ó 2017-1-10 02:17 ½s¿è

¦^´_ 2# singo1232001


·PÁ¤j¤jªº¤å³¹
¸gªG§ï½s¤§«á§Ú¤]¦¨¥\¤F,«D±`·PÁ®@!!!
¥u¬O¤Á´«¿é¤Jªkªº°ÝÃD,§Ú¬O¥á¥X¤@­Ó¤Á´«¿é¤Jªkªº°Ê§@
¤£¾å±o¦³¨S¦³¬Æ»ò¤èªk¬O¥i¥H©T©w­^¤å¿é¤Jªkªº?
  1. Set WshShell = CreateObject("wscript.shell")

  2. Do
  3.     ret = WshShell.AppActivate("¿ï¾Ü­n¤W¶ÇªºÀÉ®×")
  4. Loop Until ret = True

  5. wscript.sleep 500
  6. ret = WshShell.AppActivate("¿ï¾Ü­n¤W¶ÇªºÀÉ®×")
  7. If ret = True Then
  8.     ret = WshShell.AppActivate("¿ï¾Ü­n¤W¶ÇªºÀÉ®×")
  9.     wscript.sleep 500
  10.     WshShell.SendKeys "%n"
  11.     WshShell.SendKeys "+"
  12.     WshShell.SendKeys "C:\USERS\USER\DESKTOP\AA.JPG"
  13.     WshShell.SendKeys "%o"
  14. End If
  15. wscript.sleep 1000
½Æ»s¥N½X
PKKO

TOP

¦^´_ 2# singo1232001


    ³o­Ó¹ê¦b¤Ó»Å¤F,§Ú·P¨ì«D±`ªº¿³¾ÄÃö©ó§A§äªº³o½g¤å³¹
§Ú¤§«e¹J¨ìªºÄµ§iµøµ¡,¬O·í®É§Ú§ä¤£¨ì¬ÛÃöªººô­¶¤¸¯À
¦ý¹ê»Ú¤W«ö¤F«ö¶s¤§«áµ{¦¡½X¬O¤£·|°±¤îªº
¦]¦¹§Ú´Nºâ¦n®É¶¡¥Îsendkey ¸Ñ¨M¤F¨º­Ó°ÝÃD

¦ý«á¨Ó§Ú¹J¨ì¿ï¾ÜÀɮתº«ö¶s¤@¥¹click¤§«á´NµLªk°Ê§@¤F,¨ì¥Ø«e¤´µMµL¸Ñ
§Ú¨Ó¸Õ¸Õ¬Ý±zªºµ{¦¡½X,¥ý·PÁ¦A·PÁ¤F
PKKO

TOP

https://www.youtube.com/watch?v=G-2khNFYQl8

³á­C  ¤Ó¯«©Ô

²×©ó§ä¨ì¤F

¯uªº¦¨¥\¤F

¥u­n¾a¯Â¤å¦rÀÉ®×  Àx¦s¦¨vbs  ·d©w


"message from webpage"

§ï¦¨Äµ§iµøµ¡ªº¦WºÙ



®³¯Â¤å¦rÀɨӧ令¤U­±,°O±oÀx¦s¦¨.vbs
  1. set wshshell = createobject("wscript.shell")

  2. do
  3.     ret = wshshell.AppActivate("ºô­¶°T®§")
  4. loop until ret = true

  5.     wscript.sleep 1000
  6.     ret = wshshell.appactivate("ºô­¶°T®§")
  7.         if ret = true then
  8.                    ret = wshshell.appactivate("ºô­¶°T®§")
  9.                 wscript.sleep 1000
  10.                 wshshell.sendkeys "{enter}"
  11.         end if
  12.         wscript.sleep 1000
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡µLªk¾B¾×¡j©È®É¶¡®ø³u¡Aªá¤F³\¦h¤ß¦å¡A·QºÉ¦U¦¡¤èªk­n¾B¾×®É¶¡¡Aµ²ªG¬O¡G®ö¶O¤F§ó¦h®É¶¡¡A¥B¤@µL©Ò¦¨¡I
ªð¦^¦Cªí ¤W¤@¥DÃD