Jump to content
Sign in to follow this  
Vladi243

Creating a browser

Recommended Posts

Vladi243

Hey,

I created a browser and I have a problem. Here is the script:

#include <GUIConstants.au3>
#include <IE.au3>

Opt("GUIOnEventMode", 1); Change to OnEvent mode
_IEErrorHandlerRegister ()

$oIE1 = _IECreateEmbedded ()
$oIE2 = _IECreateEmbedded ()

#Region ### START Koda GUI section ### Form=
$Browser = GUICreate("Browser", 650, 450, 185, 145)
$First_Group = GUICtrlCreateGroup("First Surf Page", 8, 10, 633, 210)
$GUIActiveX1 = GUICtrlCreateObj($oIE1, 25, 50, 600, 160)
$GUIActiveX2 = GUICtrlCreateObj($oIE2, 25, 270, 600, 160)
$First_Link_Label = GUICtrlCreateLabel("Link", 16, 26, 24, 17)
$First_Link_Input = GUICtrlCreateInput("", 48, 24, 225, 21)
$Proxy1 = GUICtrlCreateLabel("Proxy", 304, 26, 30, 17)
$Proxy1_Input = GUICtrlCreateInput("", 344, 24, 150, 21)
$Surf1_Button = GUICtrlCreateButton("Surf", 538, 24, 80, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Second_Group = GUICtrlCreateGroup("Second Surf Page", 8, 230, 633, 210)
$Second_Link_Label = GUICtrlCreateLabel("Link", 16, 246, 24, 17)
$Second_Link_Input = GUICtrlCreateInput("", 48, 244, 225, 21)
$Proxy2 = GUICtrlCreateLabel("Proxy", 304, 246, 30, 17)
$Proxy2_Input = GUICtrlCreateInput("", 344, 244, 150, 21)
$Surf2_Button = GUICtrlCreateButton("Surf", 538, 244, 80, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;GUICtrlReads
$GUICtrlReadFirstLink = GUICtrlRead ($First_Link_Input)
$GUICtrlReadSecondLink = GUICtrlRead ($Second_Link_Input)

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Surf1_Button
            $i=0
            Do
                $i=$i+1
                _IENavigate ($oIE1, $GUICtrlReadFirstLink)
                Sleep (300000)
            Until $i=100
        Case $msg = $Surf2_Button
            $k=0
            Do
                $k=$k+1
                _IENavigate ($oIE2, $GUICtrlReadSecondLink)
                Sleep (300000)
            Until $k=1000
    EndSelect
WEnd

GUIDelete()

Exit

1. I type the url in the input box, then I click "surf", but it's not working.

2. How can I make that it surf with different proxy in each url?

Edited by Vladi243

Share this post


Link to post
Share on other sites
nobbe

you are on event mode and use a message loop - this cant work

- then read the edit fields when you click on button

- you block the event loop with 100 * sleep (30000) , how long is this ??

for using IE with different proxies you would need to write the ini entry to change it

here is something that works

#include <GUIConstants.au3>
#include <IE.au3>

;Opt("GUIOnEventMode", 1); Change to OnEvent mode
_IEErrorHandlerRegister ()

Global $oIE1 = _IECreateEmbedded ()
Global $oIE2 = _IECreateEmbedded ()

#Region ### START Koda GUI section ### Form=
$Browser = GUICreate("Browser", 650, 450, 185, 145)
$First_Group = GUICtrlCreateGroup("First Surf Page", 8, 10, 633, 210)

$GUIActiveX1 = GUICtrlCreateObj($oIE1, 25, 50, 600, 160)
$GUIActiveX2 = GUICtrlCreateObj($oIE2, 25, 270, 600, 160)

$First_Link_Label = GUICtrlCreateLabel("Link", 16, 26, 24, 17)
$First_Link_Input = GUICtrlCreateInput("", 48, 24, 225, 21)
$Proxy1 = GUICtrlCreateLabel("Proxy", 304, 26, 30, 17)
$Proxy1_Input = GUICtrlCreateInput("", 344, 24, 150, 21)
$Surf1_Button = GUICtrlCreateButton("Surf", 538, 24, 80, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Second_Group = GUICtrlCreateGroup("Second Surf Page", 8, 230, 633, 210)
$Second_Link_Label = GUICtrlCreateLabel("Link", 16, 246, 24, 17)
$Second_Link_Input = GUICtrlCreateInput("", 48, 244, 225, 21)
$Proxy2 = GUICtrlCreateLabel("Proxy", 304, 246, 30, 17)
$Proxy2_Input = GUICtrlCreateInput("", 344, 244, 150, 21)
$Surf2_Button = GUICtrlCreateButton("Surf", 538, 244, 80, 21, 0)

GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###




; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Surf1_Button
            $i=0
 ;           Do
  ;              $i=$i+1
                $GUICtrlReadFirstLink = GUICtrlRead ($First_Link_Input)
                _IENavigate ($oIE1, $GUICtrlReadFirstLink)
;                Sleep (300000)
   ;         Until $i=100
        Case $msg = $Surf2_Button
;            $k=0
 ;           Do
$GUICtrlReadSecondLink = GUICtrlRead ($Second_Link_Input)
  ;              $k=$k+1
                _IENavigate ($oIE2, $GUICtrlReadSecondLink)
   ;             Sleep (300000)
    ;        Until $k=1000
    EndSelect
WEnd

GUIDelete()
exit

Share this post


Link to post
Share on other sites
Linux

#include <GUIConstants.au3>
#include <IE.au3>

;Opt("GUIOnEventMode", 1); Change to OnEvent mode YOU DONT WANT TO USE ONEVENT MODE
;_IEErrorHandlerRegister ()

$oIE1 = _IECreateEmbedded ()
$oIE2 = _IECreateEmbedded ()

#Region ### START Koda GUI section ### Form=
$Browser = GUICreate("Browser", 650, 450, 185, 145)
$First_Group = GUICtrlCreateGroup("First Surf Page", 8, 10, 633, 210)
$GUIActiveX1 = GUICtrlCreateObj($oIE1, 25, 50, 600, 160)
_IENavigate($oIE1,"http://proxy1.info/nph-index.cgi/011110A/http/checkmyip.com/")
$GUIActiveX2 = GUICtrlCreateObj($oIE2, 25, 270, 600, 160)
_IENavigate($oIE2,"http://checkmyip.com/")
$First_Link_Label = GUICtrlCreateLabel("Link", 16, 26, 24, 17)
$First_Link_Input = GUICtrlCreateInput("", 48, 24, 225, 21)
$Proxy1 = GUICtrlCreateLabel("Proxy", 304, 26, 30, 17)
$Proxy1_Input = GUICtrlCreateInput("", 344, 24, 150, 21)
$Surf1_Button = GUICtrlCreateButton("Surf", 538, 24, 80, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Second_Group = GUICtrlCreateGroup("Second Surf Page", 8, 230, 633, 210)
$Second_Link_Label = GUICtrlCreateLabel("Link", 16, 246, 24, 17)
$Second_Link_Input = GUICtrlCreateInput("", 48, 244, 225, 21)
$Proxy2 = GUICtrlCreateLabel("Proxy", 304, 246, 30, 17)
$Proxy2_Input = GUICtrlCreateInput("", 344, 244, 150, 21)
$Surf2_Button = GUICtrlCreateButton("Surf", 538, 244, 80, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Surf1_Button
            $i=0
            Do
                $i=$i+1
                _IENavigate ($oIE1, GUICtrlRead($First_Link_Input))
                Sleep(30000)
            Until $i=100
        Case $msg = $Surf2_Button
            $k=0
            Do
                $k=$k+1
                _IENavigate ($oIE2, GUICtrlRead($Second_Link_Input))
                sleep(30000)
            Until $k=1000
    EndSelect
WEnd

GUIDelete()

Exit

hope it helps.

Edit: Ooops! nobbe posted just before! he is very helpfull! :)

Edited by Linux

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"

Share this post


Link to post
Share on other sites
Vladi243

Thank you very much guys.

nobbe,

Can you help me with the ini file and the proxy. I'm newbie in AU3 and I using the help file to learn, but it doesn't always help.

BTW, how are you making the "CODE: AutoIt" in the forum? It's much more understandable.

Share this post


Link to post
Share on other sites
Vladi243

have you seen my example?

Use autoit and /autoit with the [], instead of the CODE tags.

Thanks:)

Share this post


Link to post
Share on other sites
nobbe

use google to find

"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

then use autoit read / write to change ini settings

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.