0
我需要使用AutoIt製作的Twitter記者機器人的幫助。它使用Internet Explorer並且我的網站已損壞,所以我想將它切換到Google Chrome。修改AutoIt腳本以使用不同的瀏覽器
#NoTrayIcon
#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <String.au3>
#include <INet.au3>
#include <GUIConstantsEx.au3>
#Include <GuiEdit.au3>
#include <MsgBoxConstants.au3>
Global $o = 'opparis'
Global $n = 'TweetHollande'
Global $op_sr = 'optools.anonops.com'
Global $showie = True
$ans = MsgBox(4,"Twitter Reporter (#OpParis) - AO Tools (v.1.0.1)","Would you like to show Internet Explorer during operation? (Recommended: Yes)")
Select
Case $ans = 6
$showie = True
Case $ans = 7
$showie = False
EndSelect
$gui = GUICreate("Twitter Reporter (#OpParis) - AO Tools (v.1.0.1)", 310, 340, 200, 150)
Global $editctrl = GUICtrlCreateEdit("", 10, 10, 300, 330)
GUISetState(@SW_SHOW)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")
Func CLOSEButton()
_IEQuit($i)
Exit
EndFunc
loggin("Twitter Reporter (#OpParis) - AO Tools (v.1.0.0)"&@CRLF&@CRLF)
loggin("Starting up! Close this window at anytime to stop."&@CRLF&@CRLF)
Func updateTarget($t)
$tg = _INetGetSource("http://"&$op_sr&"/twUpdateTarget.php?o="&$o&"&t="&$t)
If $tg == "" OR $tg == "0" OR StringInStr($tg,"Website is offline") OR StringInStr($tg,"Checking your browser") Then
If $showie == True Then
$zz = _IECreate("http://"&$op_sr&"/twUpdateTarget.php?o="&$o&"&t="&$t)
Else
$zz = _IECreate ("http://"&$op_sr&"/twUpdateTarget.php?o="&$o&"&t="&$t,0,0)
EndIf
_IELoadWait($zz)
$tg = _IEBodyReadText($zz)
If StringInStr($tg,"Checking your browser") Then
sleep(6000)
$tg = _IEBodyReadText($zz)
EndIf
_IEQuit($zz)
EndIf
If $tg == "Target removed!" Then
loggin("~ Target Removed: "&$t&" ~"&@CRLF)
EndIf
EndFunc
Func loggin($message)
ConsoleWrite($message)
_GUICtrlEdit_AppendText($editctrl,$message)
EndFunc
If $showie == True Then
Global $i = _IECreate ("https://twitter.com/login")
Else
Global $i = _IECreate ("https://twitter.com/login",0,0)
EndIf
_IELoadWait($i)
$url = _IEPropertyGet($i,"locationurl")
If $url == "https://twitter.com/" Then
loggin("****"&@CRLF&"WARNING: Already logged in to Twitter in IE!"&@CRLF&@CRLF&"Dont want to use the logged-in account?"&@CRLF&"Then Please:"&@CRLF&"1.) Close this application"&@CRLF&"2.) Open Internet Explorer"&@CRLF&"3.) Logout of Twitter"&@CRLF&"4.) Restart this Application"&@CRLF&@CRLF&"***"&@CRLF)
loggin(@CRLF&"Sleeping 30 seconds for a chance for an action..."&@CRLF&@CRLF)
Sleep(30000)
Else
Local $lUser = InputBox("Login", "Enter Twitter Username", "")
$n = $lUser
Local $lPass = InputBox("Login", "Enter Twitter Password.", "", "*")
$f = _IEFormGetCollection($i, 2)
$u = _IEFormElementGetCollection ($f, 1)
$p = _IEFormElementGetCollection ($f, 2)
_IEFormElementSetValue ($u, $lUser)
_IEFormElementSetValue ($p, $lPass)
_IEFormSubmit ($f)
_IELoadWait($i)
sleep(1000)
EndIf
$url = _IEPropertyGet($i,"locationurl")
If $url <> "https://twitter.com/" Then
MsgBox($MB_SYSTEMMODAL, "Login", "Twitter Login Invalid")
_IEQuit($i)
Exit
EndIf
While 1
$tg = _INetGetSource("http://"&$op_sr&"/twGetTarget.php?o="&$o&"&n="&$n)
If $tg == "" OR $tg == "0" OR StringInStr($tg,"Website is offline") OR StringInStr($tg,"Error") OR StringInStr($tg,"Checking your browser") OR StringInStr($tg,"Cloudflare") Then
If $showie == True Then
$iz = _IECreate("http://"&$op_sr&"/twGetTarget.php?o="&$o&"&n="&$n)
Else
$iz = _IECreate ("http://"&$op_sr&"/twGetTarget.php?o="&$o&"&n="&$n,0,0)
EndIf
_IELoadWait($iz)
$tg = _IEBodyReadText($iz)
If StringInStr($tg,"Checking your browser") Then
sleep(6000)
$tg = _IEBodyReadText($iz)
EndIf
_IEQuit($iz)
EndIf
; check for cloudflare and other errors
$res = StringRegExp($tg,"%20", 3)
If @error Then
$nbOccurences = 0
Else
$nbOccurences = UBound($res)
Endif
If $nbOccurences > 2 OR $tg == "noassignment" OR $tg == "" OR $tg == "0" OR StringInStr($tg,"Error") OR StringInStr($tg,"Website is offline") OR StringInStr($tg,"Checking your browser") OR StringInStr($tg,"Cloudflare") Then
loggin("No Assignment"&@CRLF)
Sleep(10000)
Else
loggin("* Target: "&$tg)
_IENavigate($i,"https://twitter.com/"&$tg)
_IELoadWait($i)
$txt = _IEBodyReadText ($i)
sleep(1000)
If StringInStr($txt,'Sorry, that page doesn’t exist!') Then
loggin(" - Does not exist"&@CRLF)
updateTarget($tg)
ElseIf StringInStr($txt,'Account suspended') Then
loggin(" - Account suspended"&@CRLF)
updateTarget($tg)
ElseIf StringInStr($txt,'Tweets are protected.') Then
loggin(" - Reporting"&@CRLF)
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.classname == "user-dropdown dropdown-toggle js-dropdown-toggle js-link js-tooltip btn plain-btn" Then _IEAction($oInput, "click")
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Report" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "abuse" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "harassment" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "Someone_else" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "violence" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
Else
loggin(" - Reporting"&@CRLF)
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.classname == "user-dropdown dropdown-toggle js-dropdown-toggle js-link js-tooltip btn plain-btn" Then _IEAction($oInput, "click")
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Report" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "abuse" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "harassment" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "Someone_else" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
sleep(500)
$fr = _IEFrameGetCollection($i, 1)
$fm = _IEFormGetCollection($i, 1)
$oDoc = _IEDocGetObj($fr)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.value = "violence" Then
_IEAction($element, "click")
EndIf
Next
Local $oInputs = _IETagNameGetCollection($i, "button")
For $oInput In $oInputs
If $oInput.innerHtml == "Next" Then _IEAction($oInput, "click")
Next
EndIf
sleep(1000)
EndIf
WEnd
問題是,我的IE瀏覽器完全破壞,它不會更新或加載任何網頁。 –
嗯,這只是一個猜測,但通常這些問題通常是在病毒被刪除後引起的。它通常是一個快速修復。您可能想嘗試按照這些步驟來修復它。 https://www.youtube.com/watch?v=yIWMM3CGAC0 – MrAutoIt