vba±±¨îºô¶ browser¸I¤Walert°±¦í¤F
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
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³£¯à´ú¸Õªººô¯¸(¥Dn§Ú¸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¤º³¡ªº¤@©wnÂ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Óµøµ¡§Ú§¹¥þ¥Î¤£¨ì- 'Private Declare Function SetFocus Lib "user32" Alias "SetFocus2" (ByVal hwnd As Long) As Long
- 'Private Declare PtrSafe Function WinAPISetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As LongPtr) As Long
- Sub getALLBrowsersaaa()
- On Error GoTo Err_Clear
- Dim mainWorkBook As Workbook
-
-
- Set objShell = CreateObject("Shell.Application")
- Set objAllWindows = objShell.Windows
- Set mainWorkBook = ActiveWorkbook
- For Each ow In objAllWindows
- If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
- If (InStr(1, ow.LocationURL, "https://login.104.com.tw/login.cfm", vbTextCompare)) Then
-
- Set HTMLDoc = ow.document
- HTMLDoc.all.id_name.Value = "aaa" '< -±b¸¹ÀH«K¥´Åý¥L¸õĵ§i
- For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
- If MyHTML_Element.Type = "submit" And MyHTML_Element.Value = "·|ûµn¤J" Then
-
-
- ' Call Âù¶}vba <¥ý¤£¥Î,·Q¶Ç¥hµ¹Sub StartAsub() SetTimer Application.hWnd, 1, 15000, AddressOf getALLBrowsersaaa>
- MyHTML_Element.Click <--¶i¤Jie´N¥d¤F
- Do While ow.readyState <> 4 Or ow.Busy:
- DoEvents
- If ow.Busy Then
- ow.Visible = False ''´N¬O±q·sÁôÂèϥεøµ¡
- ow.Visible = True ''±µµÛ¤S«·sÅã¥Üactive¨Ï¥Îµøµ¡
- ow.document.Focus
- DoEvents
- Application.SendKeys "{ENTER}", True '**«ö¤UÁä
- End If
- Loop
- : Exit For
- End If
- Next
- End If
- End If
-
- Next
- Err_Clear:
- If Err <> 0 Then
- Err.Clear
- Resume Next
- End If
- ' Call StopAsub <¥ý¤£¥Î,·Q¶Ç¦^¥hStopAsub() killtimer>
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 549
- ¥DÃD
- 152
- ºëµØ
- 0
- ¿n¤À
- 691
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- OFFICE 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-8-10
- ³Ì«áµn¿ý
- 2022-9-7
|
¦^´_ 8# stillfish00
¤F¸Ñ,«D±`·PÁÂ! |
|
PKKO
|
|
|
|
|
- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¦^´_ 7# PKKO
·Q½Ð±Ð¤@:³oÓ»yªk¾A¥Î©ó©Ò¦³ºô¯¸ªº³æ¤@½T»{µøµ¡¶Ü?
¥¼¥²¡A¬Ýºô¯¸¬O¥ÎþºØ¤èªk¼u¥Xµøµ¡¡A·íµM§A¤]¥i¯à¬Ý¤£¥X¨Ó¥L¬O¥ÎþºØ¤èªk
¥Dn¬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±`¬On¤W¶ÇÀɮקa
³o§Ú¤£¼ô¡Aºô¶Â^¨ú«Ü¤Ö°µ¨ì¤W¶ÇÀɮתº |
|
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C
|
|
|
|
|
- ©«¤l
- 549
- ¥DÃD
- 152
- ºëµØ
- 0
- ¿n¤À
- 691
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- OFFICE 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-8-10
- ³Ì«áµn¿ý
- 2022-9-7
|
¦^´_ 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
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
§Ú«á¨Ó¦³µ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 |
|
|
|
|
|
|
- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¦^´_ 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
|
|
|
|
|
- ©«¤l
- 549
- ¥DÃD
- 152
- ºëµØ
- 0
- ¿n¤À
- 691
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- OFFICE 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-8-10
- ³Ì«áµn¿ý
- 2022-9-7
|
¥»©«³Ì«á¥Ñ 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ªº?- Set WshShell = CreateObject("wscript.shell")
- Do
- ret = WshShell.AppActivate("¿ï¾Ün¤W¶ÇªºÀÉ®×")
- Loop Until ret = True
- wscript.sleep 500
- ret = WshShell.AppActivate("¿ï¾Ün¤W¶ÇªºÀÉ®×")
- If ret = True Then
- ret = WshShell.AppActivate("¿ï¾Ün¤W¶ÇªºÀÉ®×")
- wscript.sleep 500
- WshShell.SendKeys "%n"
- WshShell.SendKeys "+"
- WshShell.SendKeys "C:\USERS\USER\DESKTOP\AA.JPG"
- WshShell.SendKeys "%o"
- End If
- wscript.sleep 1000
½Æ»s¥N½X |
|
PKKO
|
|
|
|
|
- ©«¤l
- 549
- ¥DÃD
- 152
- ºëµØ
- 0
- ¿n¤À
- 691
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- OFFICE 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-8-10
- ³Ì«áµn¿ý
- 2022-9-7
|
¦^´_ 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
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
https://www.youtube.com/watch?v=G-2khNFYQl8
³áC ¤Ó¯«©Ô
²×©ó§ä¨ì¤F
¯uªº¦¨¥\¤F
¥un¾a¯Â¤å¦rÀÉ®× Àx¦s¦¨vbs ·d©w
"message from webpage"
§ï¦¨Äµ§iµøµ¡ªº¦WºÙ
®³¯Â¤å¦rÀɨӧ令¤U±,°O±oÀx¦s¦¨.vbs- set wshshell = createobject("wscript.shell")
- do
- ret = wshshell.AppActivate("ºô¶°T®§")
- loop until ret = true
- wscript.sleep 1000
- ret = wshshell.appactivate("ºô¶°T®§")
- if ret = true then
- ret = wshshell.appactivate("ºô¶°T®§")
- wscript.sleep 1000
- wshshell.sendkeys "{enter}"
- end if
- wscript.sleep 1000
½Æ»s¥N½X |
|
|
|
|
|
|