Jump to content

2 Questions !


Recommended Posts

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
Link to comment
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!

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

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