Sign in to follow this  
Followers 0
Enforcer

2 Questions !

7 posts in this topic

Got two questions...

1) Have peace of script like this:

;=======================================================

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $EXIT

Exit

Case $GO

For $i = 1 to 300 Step 1

... bla bla bla ...

Next

;then comes another loop

While 1

... bla bla bla ...

Wend

Wend

;=======================================================

Problem: how to stop all loops and exit the program by pressing the close or exit buttons ?

Second question:

When we creating something like this:

$oIE=_IECreate ("http://www.autoitscript.com", 0, 0, 1)

and then navigating on links like this:

_IENavigate($oIE,"http://www.autoitscript.com/forum/index.php")

all flash, pictures loading there too but hiddenly - this slows down the whole process (when i must visit over 600 or more pages), does exists some function that will

disable all images and flash ??? to speed up the process... Help please...


[RU] Zone

Share this post


Link to post
Share on other sites



1) Since you constantly lock up your message loop your GUI will be not be responding very well. Test using On Event mode instead, it basicly works like this:

Opt("GUIOnEventMode",1)
GUICreate("Hello!")
GUISetOnEvent(-3,"close")
GUISetState()
while 1
    sleep(10)
    ; Here you can do what you want, no need consider the GUI :)
WEnd
Func close ()
    Exit
EndFunc

2) Change your global internet explorer settings :D


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

THX For reaply monoceres =) !

But for second answear I mean something like autoit function)) I know that i can change everything what i want in explorer bu will be better if exists some function that will do the trick


[RU] Zone

Share this post


Link to post
Share on other sites

Enforcer

Another method:

#include <GuiConstants.au3>

$hGui = GUICreate("Test", 200, 100)

$button = GUICtrlCreateButton("Go", 20, 60, 75, 23)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $button
            _MyFunc()
    EndSwitch
WEnd


Func _MyFunc()
    ConsoleWrite("_MyFunc" & @LF)
    While 1
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
        Sleep(50)
    WEnd
EndFunc

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Second question:

When we creating something like this:

$oIE=_IECreate ("http://www.autoitscript.com", 0, 0, 1)

and then navigating on links like this:

_IENavigate($oIE,"http://www.autoitscript.com/forum/index.php")

all flash, pictures loading there too but hiddenly - this slows down the whole process (when i must visit over 600 or more pages), does exists some function that will

disable all images and flash ??? to speed up the process... Help please...

A couple of thoughts...

1) If you're actually using this to read forum pages, most forums have a 'print' mode, that will kill (most) images for you:

http://www.autoitscript.com/forum/index.ph...f=2&t=69277

2) When you create a spider, you should put out custom headers (with your email address), so the spider can be identified, and blocked if necessary.

3) It's also polite to put a pause between each page grab (a small sleep(X) is all you need). Otherwise, you're rudely pounding away at somebody else's server. You may want your script to run faster, but try to be polite to the people who are supplying the content you want (or they'll just ban your IP).

4) If you really are using this to read the AutoIt forums, you should seriously consider making a donation to help cover the costs of the bandwidth.

Edited by aGorilla

Share this post


Link to post
Share on other sites

nope this was just an example, actualy I'm using this to visit some pages and post messages :D not forums... just web sites :D (I'ts a message bot or some kind of that)


[RU] Zone

Share this post


Link to post
Share on other sites

Figured it might be. You should still probably do a short sleep, if you're hitting the same site, and you might still be able to take advantage of a 'print' format.

Good luck with it, and if you find a solution, please post it. I may be able to use it myself soon (I'll be doing a lot of web oriented work).

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