Jump to content

Word search method post Question


Recommended Posts

how to word method post jump one by one?

#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
Global $aResult, $aNumberofquery
$Form1_1 = GUICreate("Form1", 543, 255)
$Editkeywordsearch = GUICtrlCreateEdit("", 16, 56, 113, 169)
GUICtrlSetData(-1, "word1" & @CRLF & "word2" & @CRLF & "word3")
$EditUrl = GUICtrlCreateEdit("" & @CRLF, 144, 56, 369, 177, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL))
$list = GUICtrlCreateButton("List", 360, 8, 147, 33)
GUISetState(@SW_SHOW)
While 1

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $list
             $ReadEditlines = 1
            $aReadEditline = StringSplit(StringStripCR(GUICtrlRead($Editkeywordsearch)), @LF)
            For $aSearchlist = 1 To UBound($aReadEditline) - 1
         $ReadEditlines = Searchmylist("/index.php", $ReadEditlines)
            If $ReadEditlines = 0 Then ExitLoop
            Next
            ConsoleWrite("finisher")
    EndSwitch
WEnd

Func connectWebSite($address, $iWord = 1)
    $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    $oMyError = ObjEvent("AutoIt.Error", "httperror")
    $oHTTP.Open("POST", $address, False)
    $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0")
    $oHTTP.SetRequestHeader("Accept-Language", "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3")
    $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
     $oHTTP.Send("name=" & $aReadEditline[$iWord] & "&catacory=catacory2")
      ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aReadEditline[$iWord]  = ' & $aReadEditline[$iWord]  & @CRLF & '>Error code: ' & @error & @CRLF)
    $oReceived = $oHTTP.ResponseText
    $oStatusCode = $oHTTP.Status
    If $oStatusCode = 200 Then
        Return $oReceived
    Else
        Return -1
    EndIf
EndFunc

Func httperror()
    ConsoleWrite("error http" & @CRLF)
EndFunc

Func Searchmylist($query, $iWord = 1)
    $connected = False
    $url = "http://youtubertr.com" & $query
    $response = connectWebSite($url, $iWord)
    If $response <> -1 Then
        $connected = True
        EndIf

    If $connected Then
        $response = BinaryToString($response, 4)
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $response  = ' & $response  & @CRLF & '>Error code: ' & @error & @CRLF)

        $aNumberofquery = StringRegExpReplace($response, "(?s).+z:\h*<b>(\d+?)<\/b><br.*", "$1")
        If $aNumberofquery < 1 Then
            Searchmylist($query, $iWord)
        Else

            $aReceivedData = StringRegExp($response, '(?i)title="(http://.+?)"\hrel', 3)

            For $z = 0 To UBound($aReceivedData) - 1

                If StringInStr($aReceivedData[$z], "://") Then
                    $Link = $aReceivedData[$z]
                    $aResult &= $Link & @CRLF
GUICtrlSetData($EditUrl, $aResult & @CRLF, 1)
                EndIf
          $iWord += 1
               Next
        EndIf
    Else
        ConsoleWrite("Could not connect")
        Searchmylist($query, $iWord)
    EndIf
EndFunc

 

Edited by youtuber
Link to comment
Share on other sites

Your recursive function Searchmylist seems to be an endless loop. You have to add a criteria to exit the recursion, for example when the end of the list has been reached.

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Words -1 finish exit the loop after a word?
 

 Dim $aControl[UBound($aReadEditline)]

 If $aControl = -1 Then ExitLoop
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
Global $aResult, $aNumberofquery
$Form1_1 = GUICreate("Form1", 543, 255)
$Editkeywordsearch = GUICtrlCreateEdit("", 16, 56, 113, 169)
GUICtrlSetData(-1, "word1" & @CRLF & "word2" & @CRLF & "word3")
$EditUrl = GUICtrlCreateEdit("" & @CRLF, 144, 56, 369, 177, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL))
$list = GUICtrlCreateButton("List", 360, 8, 147, 33)
GUISetState(@SW_SHOW)
While 1

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $list
             $ReadEditlines = 1
            $aReadEditline = StringSplit(StringStripCR(GUICtrlRead($Editkeywordsearch)), @LF)
            For $aSearchlist = 1 To UBound($aReadEditline) - 1
         $ReadEditlines = Searchmylist("/index.php", $ReadEditlines)
            If $ReadEditlines = 0 Then ExitLoop
            Next
            ConsoleWrite("finish")
    EndSwitch
WEnd

Func connectWebSite($address, $iWord = 1)
    $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    $oMyError = ObjEvent("AutoIt.Error", "httperror")
    $oHTTP.Open("POST", $address, False)
    $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0")
    $oHTTP.SetRequestHeader("Accept-Language", "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3")
    $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
     $oHTTP.Send("name=" & $aReadEditline[$iWord] & "&catacory=catacory2")
      ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aReadEditline[$iWord]  = ' & $aReadEditline[$iWord]  & @CRLF & '>Error code: ' & @error & @CRLF)
    $oReceived = $oHTTP.ResponseText
    $oStatusCode = $oHTTP.Status
    If $oStatusCode = 200 Then
        Return $oReceived
    Else
        Return -1
    EndIf
EndFunc

Func httperror()
    ConsoleWrite("error http" & @CRLF)
EndFunc

Func Searchmylist($query, $iWord = 1)
    $connected = False
     Dim $aControl[UBound($aReadEditline)]
    $url = "http://youtubertr.com" & $query
    $response = connectWebSite($url, $iWord)
    If $response <> -1 Then
        $connected = True
        EndIf

    If $connected Then
        $response = BinaryToString($response, 4)
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $response  = ' & $response  & @CRLF & '>Error code: ' & @error & @CRLF)

        $aNumberofquery = StringRegExpReplace($response, "(?s).+z:\h*<b>(\d+?)<\/b><br.*", "$1")
        If $aNumberofquery < 1 Then
            Searchmylist($query, $iWord)
        Else

            $aReceivedData = StringRegExp($response, '(?i)title="(http://.+?)"\hrel', 3)

            For $z = 0 To UBound($aReceivedData) - 1

                If StringInStr($aReceivedData[$z], "://") Then
                    $Link = $aReceivedData[$z]
                    $aResult &= $Link & @CRLF
GUICtrlSetData($EditUrl, $aResult & @CRLF, 1)
                EndIf
          $iWord += 1
         If $aControl = -1 Then ExitLoop
               Next
        EndIf
    Else
        ConsoleWrite("Could not connect")
        Searchmylist($query, $iWord)
    EndIf
EndFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...