Sign in to follow this  
Followers 0
jodayautoit

User input via IP address to a Webpage

4 posts in this topic

Hi all!

I am new to Autoit and am a beginner to using it to automate some testing at work. I have used the Au3recorder and seen how it records functions etc. Used the Autoit help file and the examples here in forums. This maybe so simple that I just do not see it. My question is I can create a message box or even a user input box but I cannot seem to figure out how to take the user input ( in this case an IP address) and place it as the data to be used for Internet Explorer to open a browser session to.

First script does this.

#include <IE.au3>

; Create a browser window and navigate to

$oIE = _IECreate("X.X.X.X") If I put in an IP address here IE will open the webpage. This works if you do not require user to input IP.

Another way that a member suggested that works is if you want to create your own simple browser. This also works and asks the user for the IP address and will open the webpage. I would like to have a script that asks the user to input the IP address and start a normal Internet Explorer session using that IP address. Could one of the members point me in the right direction. I am also new to this Forum so I apologize if this is in the wrong area. Please advise. Thanks for your assistance in advance.

#include <GUIConstants.au3>

#include <IE.au3>

$GUI = GUICreate("Simple Web Browser", 1679, 1000)

$object = ObjCreate("Shell.Explorer.2")

$object_ctrl = GUICtrlCreateObj($object, 1, 10, 1679, 900)

$url_button = GUICtrlCreateButton("URL", 500, 950, 500, 25, 0)

_IENavigate($object, "about blank")

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $url_button

$URL = Inputbox("Web Browser", "Enter the URL you want to visit.")

_IENavigate($Object, $URL)

;_IEPropertyGet($Object, "hwnd")

WinSetState($Object, "", @SW_MAXIMIZE)

_WinWaitActivate("Simple Web Browser","")

Share this post


Link to post
Share on other sites



My question is I can create a message box or even a user input box but I cannot seem to figure out how to take the user input ( in this case an IP address) and place it as the data to be used for Internet Explorer to open a browser session to.

Maybe I didn't understand your question but it is as simple as:

#include <IE.au3>
$sourceip=InputBox("","IP address") ;(you can use 209.85.147.147 as a test)
; Create a browser window and navigate to
$oIE = _IECreate($sourceip)

Share this post


Link to post
Share on other sites

Maybe I didn't understand your question but it is as simple as:

#include <IE.au3>
$sourceip=InputBox("","IP address") ;(you can use 209.85.147.147 as a test)
; Create a browser window and navigate to
$oIE = _IECreate($sourceip)

Share this post


Link to post
Share on other sites

Thanks Sahsanu!

You understood exactly what I was looking for. I see now what I was not getting. I was not using a variable correctly in the Inputbox statement. I had it after the IP address question. in this case $sourceIP. I was using $input but in wrong location.

Thanks again my question has been answered.

I will probably have more questions as I get this test script built.

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