Jump to content

Recommended Posts

Posted

I want to make a Gui in which you type in the web address, press enter, and then it will open up the Website in IE, here is my code below:

#include <IE.au3>
$Gui = GUICreate("Title",500,500)
$input = GUICtrlCreateInput("Enter",125,125)
$Button1 = GUICtrlCreateButton("Enter",100,100)
GUISetState(@SW_SHOW)
While 1
Case $Button1
_IENavigate($input)
sleep(1)
WEnd
Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list]
Posted

Hello Dasttann777

Read your helpfile.

_IENavigate is missing a parameter, and you have not created an IE object in which to navigate.

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Posted (edited)

You might understand better if you take a moment to read the help file on the function _IENavigate().

_IENavigate() requires 2 parameters, first a pointer to the object in which your trying to navigate, and second the path in which your attempting to navigate too. The third parameter is optional.

_IENavigate($oIE, $url)

Read the Helpfile on _IENavigate() to understand how the function is more correctly used, and then read on these two ways to create a pointer to the object in which you wish to navigate:

_IEAttach()

_IECreate()

Realm

Edit: Re-arranged my wording, since my first draft appeared to be coming off rude as I re-read after posting.

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Posted

#region Include
#include <GuiStatusBar.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#Include <GuiToolTip.au3>
#include <Process.au3>
#include <IE.au3>
#include <EditConstants.au3>
#Include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#endregion
#region Set Options
Opt('MustDeclareVars', 0)
Opt("WinTitleMatchMode", 2)
TrayTip("Click Tray Icon", "Click the Tray Icon to Pause the script at any time!", 5,1)
#endregion
$Ver = "1.0"
#region Global Variables
Global  $Browser="IE",$WebPage="None",$UpdateMsg="Your Business"
Global  $aText[3]  = [$UpdateMsg , $WebPage, $Browser]
Global  $aParts[3] = [100, 450, -1]
Global  $button_1, $button_2,$Go,$MainGUI,$hStatus,$InputWebsite,$fActivate,$label_1,$L1,$I1,$LastWebSite,$oIE
#endregion
#region Variables
$oIE = ""
$L1="Please enter web address - then press GO!"
$I1="http://www."
$LastWebSite = RegRead("HKEY_CURRENT_USER\Software\WebBrowser","LastWebSite")
If $LastWebSite <> "" Then $I1 = $LastWebSite
#endregion
#region Main GUI create
$MainGUI  =  GUICreate("Browser  Ver."&$Ver, 500, 80,10,@DesktopHeight-140)
    GUISetBkColor(0xE0FFFF            )
    _GUIToolTip_Activate($MainGUI, $fActivate = True       )
$hStatus   =  _GUICtrlStatusBar_Create  ($MainGUI, $aParts, $aText    )
$Go =  GUICtrlCreateButton("Go",437,01, 20, 20,  $BS_DEFPUSHBUTTON  )
$button_1   =  GUICtrlCreateButton("P", 458,01, 20, 20        )
$button_2   =  GUICtrlCreateButton("R", 479,01, 20, 20        )
$label_1   =  GUICtrlCreateLabel($L1,   10,10,230, 20      )
$InputWebsite= GUICtrlCreateInput($I1,   05,30,480, 20     )
#endregion
#region Main Loop
GUISetState()
While 1
  Switch GUIGetMsg()
   Case $GUI_EVENT_CLOSE
    Exit
   Case $button_1
   Case $button_2
   Case $Go
    _GoToSite()
   Case Else
  EndSwitch
WEnd
Exit
#endregion
;Functions ----------------------------------------------------------------
Func _GoToSite()
$LastWebSite=GUICtrlRead($InputWebsite)
If $oIE = "" Then
  $oIE = _IECreate ($LastWebSite)
Else
  _IENavigate($oIE,$LastWebSite)
EndIf
RegWrite("HKEY_CURRENT_USER\Software\WebBrowser","LastWebSite", "REG_SZ", $LastWebSite)
EndFunc
Try this: (first time trying to post some code, so sorry if it does not come out right)

Posted

In the previous post I posted my code for which you requested. Note I left some buttons for you to fill in as you please (you can add previous -page, or other items to the P or R buttons)

Also this code will remember the last web site visted, and will show it in the input box when the app is re-opened.

I use region commands to keep the areas separate for ease of troubleshooting the code. And it helps the the code nice and clean.

If you toggle all folds (under View - in Scite) you can clearly the regions and what they are doing.

Hope this helps...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...