Jump to content
Sign in to follow this  
IrembrU

Simple IE Browser Control Problem.

Recommended Posts

IrembrU

Hello I am having trouble with a simple browser control issue.

Local $oIE = _IECreateEmbedded()
GUICreate("IEWpLoginAuto", 640, 580, _
(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
Local $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Local $GUI_Button_Refresh = GUICtrlCreateButton("Refresh", 120, 420, 100, 30)
Local $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Local $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)
GUISetState() ;Show GUI

_IENavigate($oIE, "http://filehop.org/wp-login.php")

While 1
If _IsPressed("Home") then
_IENavigate($oIE, "http://www.autoitscript.com")
EndIf
If _IsPressed($GUI_Button_Back) then
_IEAction($oIE, "back")
EndIf
If _IsPressed($GUI_Button_Refresh) then
_IEAction($oIE, "refresh")
EndIf
If _IsPressed("Stop") then
_IEAction($oIE, "stop")
EndIf
WEnd


Exit

Basically my buttons do not work properly.

I got this code from the LibFunctions directory on Autoit's main website. That script works just fine and opens a window with the correct buttons and everything. However that code does not allow you to send Tab or anything to the actual website.

I noticed that there was a msg variable attached to each string in that code, so I thought if I took that out and defined the buttons myself I could add additional options to the window.

Main point is I'm trying to get this code to work and I am having some issues.

Thank you in advance for your help.

Share this post


Link to post
Share on other sites
Danp2

_IsPressed() won't work for buttons; It's for checking keystrokes. Suggest that you revert to the example and then attempt to resolve your issue of sending keystrokes to the webstie.

Share this post


Link to post
Share on other sites
ileandros

Please try to add includes next time cuz i have to search everytime some1 doesnt and its not funny ;)

Hope this answer covers your question

#include <IE.au3>
#include <Misc.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
Local $oIE = _IECreateEmbedded()
GUICreate("IEWpLoginAuto", 640, 580, _
(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
Local $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Local $GUI_Button_Refresh = GUICtrlCreateButton("Refresh", 120, 420, 100, 30)
Local $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Local $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)
GUISetState() ;Show GUI
$oIE.navigate('http://filehop.org/wp-login.php')
While 1
If _IsPressed("24") Then $oIE.navigate('http://www.autoitscript.com')
If _IsPressed("74") Then $oIE.refresh
If _IsPressed("08") Then $oIE.GoBack
If _IsPressed("13") Then $oIE.stop
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_Button_Home
$oIE.navigate('http://www.autoitscript.com')
Case $GUI_Button_Back
$oIE.GoBack
Case $GUI_Button_Refresh
$oIE.refresh
Case $GUI_Button_Stop
$oIE.stop
EndSwitch
WEnd
Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites
BrewManNH

If you use the full version of Scite4AutoIt3 you can add "#AutoIt3Wrapper_Add_Constants=y" to the top of the script and AutoIt3Wrapper will add the needed includes for the constants to the script, it should make things easier that way.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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  

×