Jump to content

Recommended Posts

Posted (edited)

hello com,

i have designed a simple webbrowser with basic functions like "go to page" and "home"

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <Misc.au3>

$IE = _IECreateEmbedded ()

Global $html

#Region ### START Koda GUI section ### Form=C:\Users\Admin\Desktop\browser.kxf
$gui_main = GUICreate("Slim-Browser", @DesktopWidth, @DesktopHeight, 0, 0,$WS_MAXIMIZEBOX+$WS_MAXIMIZE)
$gui_url = GUICtrlCreateInput("http://", 48, 8, 289, 21)
$Label1 = GUICtrlCreateLabel("URL:", 8, 8, 29, 17)
GUICtrlSetFont(-1, 12, 400, 0, "ARIAL")
$gui_send = GUICtrlCreateButton("Go!", 344, 8, 65, 25, 0, $WS_GROUP)
$gui_home = GUICtrlCreateButton("Home", 416, 8, 65, 25, 0, $WS_GROUP)
$browser = GUICtrlCreateObj($IE,0, 40, @DesktopWidth, 800)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

_IENavigate($IE,"http://www.google.de")
$home = _IENavigate($IE,"http://www.google.de")

HotKeySet ( "{ENTER}" ,"lol")

func lol ()
     $html = GUICtrlRead($gui_url)
;~          MsgBox(0,"",$html);funzt doch...
            _IENavigate($IE,$html)
            endfunc
    

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    If WinActive("Slim-Browser") And _IsPressed("0D") Then $nMsg = $gui_send
        
        Case $GUI_EVENT_CLOSE
            Exit

        case $gui_home
            $home = _IENavigate($IE,"http://www.google.de")

        case $GUI_send
            $html = GUICtrlRead($gui_url)
;~          MsgBox(0,"",$html);funzt doch...
            _IENavigate($IE,$html)
    EndSwitch
WEnd

my problem is that if there's entered a webpage e.g. "xy.com" and i'm in google and type something in and then hit enter it goes to the webpage in the url-box, but it should google my input in google instead.

if you don't understand my issue please simply run this script.

other questions:

  • - is there a way to clear the inputbox when hitting enter?
  • - can this script can be optimized?
  • - if i want to close the browser and it's currently opening a page it isn't closing. how to fix this?

sorry for my bad english,

i'm a student from germany

best regards, seloflash

Edited by seloflash
Posted

moin moin,

dein hotkeyset nimmt die enter-taste für sich in anspruch,

das mal auskommentieren. dann klappt schon mal die google-suche auf enter. rest muss ich nochmal schauen.

in english:

your hotkeyset grabs the enter-key. do this as a comment-line.

then google-search works hitting the enterkey.

Posted

hello,

i made some changes:

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <Misc.au3>
#include <INet.au3>
Opt("GuiOnEventMode", 1)

#Region ### START Koda GUI section ### Form=C:\Users\Admin\Desktop\browser.kxf
$gui_main = GUICreate("Slim-Browser", @DesktopWidth, @DesktopHeight, 0, 0,$WS_MAXIMIZEBOX+$WS_MAXIMIZE)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$IE = _IECreateEmbedded ()
$browser = GUICtrlCreateObj($IE,0, 40, @DesktopWidth, 800)
$gui_url = GUICtrlCreateInput("http://", 48, 8, 289, 21)
$Label1 = GUICtrlCreateLabel("URL:", 8, 8, 29, 17)
GUICtrlSetFont(-1, 12, 400, 0, "ARIAL")
$gui_send = GUICtrlCreateButton("Go!", 344, 8, 65, 25, 0, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_go")
$gui_home = GUICtrlCreateButton("Home", 416, 8, 65, 25, 0, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_home")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 _IENavigate($IE,"http://www.google.de")

While 1
    sleep(20)
WEnd
func _quit()
    exit
endfunc
func _home()
    _IENavigate($IE,"http://www.google.de")
endfunc
func _go()
    if stringlen (_INetGetSource ( GUICtrlRead($gui_url))) > 0 then
        _IENavigate($IE,GUICtrlRead($gui_url))
        GUICtrlSetData($gui_url, "http://")
    endif
endfunc

works now like it should.

p.s.: hier im forum am besten immer englisch schreiben,

sollen alle verstehen und es ist ja auch n englisches forum.

im deutschsprachigen empfehle ich folgende autoitseite:

p.s.: here in the forum always write in english,

because it is an english forum.

but there is also an german autoit site:

http://www.autoit.de/index.php?page=Index

Posted

  On 11/1/2010 at 10:44 PM, 'hessebou said:

hello,

i made some changes:

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <Misc.au3>
#include <INet.au3>
Opt("GuiOnEventMode", 1)

#Region ### START Koda GUI section ### Form=C:\Users\Admin\Desktop\browser.kxf
$gui_main = GUICreate("Slim-Browser", @DesktopWidth, @DesktopHeight, 0, 0,$WS_MAXIMIZEBOX+$WS_MAXIMIZE)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$IE = _IECreateEmbedded ()
$browser = GUICtrlCreateObj($IE,0, 40, @DesktopWidth, 800)
$gui_url = GUICtrlCreateInput("http://", 48, 8, 289, 21)
$Label1 = GUICtrlCreateLabel("URL:", 8, 8, 29, 17)
GUICtrlSetFont(-1, 12, 400, 0, "ARIAL")
$gui_send = GUICtrlCreateButton("Go!", 344, 8, 65, 25, 0, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_go")
$gui_home = GUICtrlCreateButton("Home", 416, 8, 65, 25, 0, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_home")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 _IENavigate($IE,"http://www.google.de")

While 1
    sleep(20)
WEnd
func _quit()
    exit
endfunc
func _home()
    _IENavigate($IE,"http://www.google.de")
endfunc
func _go()
    if stringlen (_INetGetSource ( GUICtrlRead($gui_url))) > 0 then
        _IENavigate($IE,GUICtrlRead($gui_url))
        GUICtrlSetData($gui_url, "http://")
    endif
endfunc

works now like it should.

p.s.: hier im forum am besten immer englisch schreiben,

sollen alle verstehen und es ist ja auch n englisches forum.

im deutschsprachigen empfehle ich folgende autoitseite:

p.s.: here in the forum always write in english,

because it is an english forum.

but there is also an german autoit site:

http://www.autoit.de/index.php?page=Index

that's not what i'm looking for

i want this browser to grab the enter button only if the input box is active

if it's not active it should ungrab the inputbox!

Posted

ok now i understand. try this one:

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <Misc.au3>
#include <INet.au3>
Opt("GuiOnEventMode", 1)

#Region ### START Koda GUI section ### Form=C:\Users\Admin\Desktop\browser.kxf
$gui_main = GUICreate("Slim-Browser", @DesktopWidth, @DesktopHeight, 0, 0,$WS_MAXIMIZEBOX+$WS_MAXIMIZE)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$IE = _IECreateEmbedded ()
$browser = GUICtrlCreateObj($IE,0, 40, @DesktopWidth, 800)
$gui_url = GUICtrlCreateInput("http://", 48, 8, 289, 21)
$Label1 = GUICtrlCreateLabel("URL:", 8, 8, 29, 17)
GUICtrlSetFont(-1, 12, 400, 0, "ARIAL")
$gui_send = GUICtrlCreateButton("Go!", 344, 8, 65, 25, 0, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_go")
$gui_home = GUICtrlCreateButton("Home", 416, 8, 65, 25, 0, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_home")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 _IENavigate($IE,"http://www.google.de")
$ht = 0
While 1
    sleep(20)
    if stringlen(GUICtrlRead($gui_url)) > 9 and $ht = 0 Then
        HotKeySet ( "{ENTER}" ,"_go")
        $ht = 1
    endif
WEnd
func _quit()
    exit
endfunc
func _home()
    _IENavigate($IE,"http://www.google.de")
endfunc
func _go()
    $ht = 0
    HotKeySet ( "{ENTER}")
    if InetGetSize ( GUICtrlRead($gui_url) ,1) > 0 or StringLen(_INetGetSource ( GUICtrlRead($gui_url) )) > 0 then
        _IENavigate($IE,GUICtrlRead($gui_url), 0)
        GUICtrlSetData($gui_url, "http://")
    endif
endfunc

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