Jump to content

navigate to next page in search results


Recommended Posts

Here is a sample script I just got called away from my desk so I haven't tested it yet but the concept should work. Basically go to the place you want this script to click and press ctrl s from than on out anytime you press ctrl n it will click on that spot. Escape ends the program or you could go to the bottom right corner and click exit. If it were me I would only have it work in certain windows so you might want to slap a window specific if statment on it. It also just occured to me ctrls is a stupid key to use so you might want to switch it so it doesn't adversly effect your saving.

Global $Paused
HotKeySet("^n", "FunNext") ;ctrl+n goes to next page
HotKeySet("^s", "FunSet") ;ctrl+s sets location, click ctrl s on the location you want to click the 1st time
HotKeySet("{ESC}", "Terminate")

Dim $location

While 1
    Sleep(100)
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func FunSet()

$location=mousegetpos()

EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func FunNext()

mouseclick("left",$location[0],$location[1],1,0)

EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func Terminate()
    Exit 0
EndFunc


            
        

        

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


GMK
            
            
                Posted 
                
            
        
    
    
        


GMK
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 434
                            
                                
                            
                        
                        
                            
                                
                                    
                                        
                                        3
                                
                                    
                                
                            
                        
                    
                
            
            
                

    
    
        
 
    
    

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            This is example onlyOK if I go to this url:http://www.americanclassifieds.com/browse....uesttimeout=300Results are on multiple pagesWhich AutoIt function would allow me to do this?ThanksSteveWhich AutoIt function would allow you to do what?  If you're trying to navigate to the pages, look into the IE UDF help files.


            
        

        

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


DaleHohm
            
            
                Posted 
                
            
        
    
    
        


DaleHohm
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                MVPs
                
                    
                
            
            
                
                    
                        
                            
                                
                            
                                 5.9k
                            
                                
                            
                        
                        
                            
                                
                                    
                                        
                                        11
                                
                                    
                                
                            
                        
                    
                
            
            
                

    
    
        
Think of IE as an API...
    
    

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            Easiest would be _IELinkClickByText

Dale


            
        

        

        
            

    
        

        
            
    Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl



    MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model



    Automate input type=file (Related)



    Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?



    IE.au3 issues with Vista - Workarounds



    SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y



    Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?



    Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

        
    

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    
        
            
                
                    Moderators
                
                
                
                
            
        
    

    
        
            
                


    
        
    

                
                
                
                
                    
                        

                    
                
            
        
        
            
                


SmOke_N
            
            
                Posted 
                
            
        
    
    
        


SmOke_N
            
        
        
            
                
                    


    
        
    

                    
                        
                    
                    
                        

                    
                
            
            
                Moderators
                
                    
                
            
            
                
                    
                        
                            
                                
                            
                                 16.3k
                            
                                
                            
                        
                        
                            
                                
                                    
                                        
                                        49
                                
                                    
                                
                            
                        
                    
                
            
            
                

    
    
        
It's not what you know ... It's what you can prove!
    
    

            
        
    
    
        



    
        
            
                
                    
                    
                        Moderators
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            I don't have time to debug why (on my system (seems to be having issues at the moment with a lot of things... ie msgbox's being surpressed)) _IEBodyReadHTML is failing (might be frames, I don't know)... but I replaced it with _InetGetSource() so you would have an idea....

#include <ie.au3>
#include <inet.au3>
Global $sURL, $oIE, $aTotalPages, $nTPages, $iCC, $sURLText
$sURL = "http://www.americanclassifieds.com/browse.cfm?classID=18&paper=53&requesttimeout=300"
$sURLText = _INetGetSource($sURL)
$oIE = _IECreate($sURL)
$aTotalPages = StringRegExp($sURLText, "(?s)(?i)Miscellaneous&searchTotal=(\d+)\&", 1)
If IsArray($aTotalPages) = 0 Then
    MsgBox(16, 'Error', 'Seems to only be this page')
    Exit
EndIf
$nTPages = Int(Round((Int($aTotalPages[0])/10), 0)) ; 10 is how many show on each page
For $iCC = 2 To $nTPages
    If MsgBox(36, "Continue?", "Would you like to go to the next page?") = 7 Then ExitLoop
    _IENavigate($oIE, "http://www.americanclassifieds.com/browse.cfm?1=1&criteria=&classification" & _
        "=18&paper=53&searchPaperRegion=0&searchPapers=&searchTotal=207&%20Miscellaneous&startRow=" & $iCC & "1")
Next

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...