Sign in to follow this  
Followers 0
nhd1986

Help Me Create A Code: Find Links On A Webpaper

7 posts in this topic

can anyone help me to create a code which is about finding links on a webpaper :think:

thanks :(

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Lesson 15 from "Welcome to Autoit 1-2-3"... in my signature below

; demonstration to find chracters that change between to standard points
; or just find a string
#include <IE.au3>

#Region --- IE-Builder generated code Start ---

$oIE = _IECreate ()

;------------- User input --------------
_IENavigate ($oIE, "http://www.autoitscript.com/"); web address
$Find = "LZ"; my info shows after this line... or just find this line
$Before = "comp"; my info shows before this line... or set as ""
; ------------ End User input -------------
Sleep(1000)
$body =  _IEBodyReadHTML ($oIE)
$sloc = @TempDir & "\stest.txt"
FileDelete($sloc)
FileWrite($sloc, $body)
$sfile = FileOpen($sloc, 0)
$num = 0
While 2
    $num = $num + 1
    $sline = FileReadLine($sfile, $num)
    If @error Then
        MsgBox(262208, "Fail", "The string was NOT found   ")
        FileClose($sfile)
        Exit
    EndIf
    If StringInStr($sline, $Find) Then
        MsgBox(64, "Success", "The string " & $Find & " was found   " & @CRLF & " on line # " & $num, 5)
        If $Before = "" Then ExitLoop
        $Found = stringbetween($sline, $Find, $Before)
        MsgBox(64, "Found", "The string is " & $Found & "   ", 5)
        ExitLoop
    EndIf
WEnd

Func stringbetween($str, $start, $end)
    $pos = StringInStr($str, $start)
    If Not @error Then
        $str = StringTrimLeft($str, $pos + StringLen($start) - 1)
        $pos = StringInStr($str, $end)
        If Not @error Then
            $str = StringTrimRight($str, StringLen($str) - $pos + 1)
            Return $str
        EndIf
    EndIf
EndFunc ;==>stringbetween

#EndRegion --- IE-Builder generated code End ---

this will do the trick, however

to get all the "stuff" you need and learn how to use it....

go here

http://www.autoitscript.com/forum/index.php?showtopic=21048#

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

thanks bro Valuater, i was understanding about ur code :think:

you wanted to write a webpaper code to a text file then search someone on it.

i know IE = internet explorer, so if i use ur code with firefox or other webbrowser, can it run? :(, i know i'm noob, hope u help me so much

Thanks for help me

Edited by nhd1986

Share this post


Link to post
Share on other sites

thanks bro Valuater, i was understanding about ur code :think:

you wanted to write a webpaper code to a text file then search someone on it.

i know IE = internet explorer, so if i use ur code with firefox or other webbrowser, can it run? :(, i know i'm noob, hope u help me so much

Thanks for help me

Not working in Firefox, because the Internet Explorer Automation UDF Library for AutoIt take those Objects of Internet Explorer (does it sound redundant, not?) lol.

Share this post


Link to post
Share on other sites

thanks bro

what code can help my code which know a webpaper load full(100%) or not ?_?

Share this post


Link to post
Share on other sites

thanks bro

what code can help my code which know a webpaper load full(100%) or not ?_?

take a look to this:

; Function Name:    _IELoadWait()
; Description:      Wait for a browser page load to complete before returning
; Parameter(s):     $o_object   - InternetExplorer.Application object
;                   $i_delay    - wait this many milliseconds before checking status
; Requirement(s):   AutoIt3 Beta with COM support (post 3.1.1)
; Return Value(s):  On Success  - Returns an object variable pointing to
;                  On Failure   - 0  and sets @ERROR = 1
; Author(s):        Dale Hohm
;
;===============================================================================
;
Func _IELoadWait($o_object, $i_delay = 0)
    If IsObj($o_object) Then
        $s_oname = ObjName($o_object)
        Sleep($i_delay)
        While ($o_object.document.readyState <> "complete") and ($o_object.document.readyState <> 4) <===== Here this can help you...
            Sleep(100)
        WEnd
        SetError(0)
        Return 1
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc  ;==>_IELoadWait

Share this post


Link to post
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
Sign in to follow this  
Followers 0