Jump to content

Problem Using Alex Web Browser with Search Eng Eg Google


ds10025
 Share

Recommended Posts

Hi I am using Alex Web Browser. It works fine. But, the problem is that it do not work with any search engineer, eg www.google.com.

It will display the webpage. But, will not do any search.

Any Ideas?

#NoTrayIcon

#region Includes

#include <GUIConstants.au3>

#include <IE.au3>

#include <Inet.au3>

#include <String.au3>

#endregion

Global $Menuitem[100]

$Browser = _IECreateEmbedded()

_IEErrorHandlerRegister()

$Width = 800

$Hight = 600

$Gui = GUICreate("Alek's Web Browser",800,600,-1,-1,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Menu1 = GUICtrlCreateMenu("Stuff")

$Menuitem[1] = GUICtrlCreateMenuItem("View Source",$Menu1)

$Menuitem[2] = GUICtrlCreateMenuItem("Home page",$Menu1)

$Menu2 = GUICtrlCreateMenu("Favorites")

$Menuitem[3] = GUICtrlCreateMenuItem("Add Favorite",$Menu2)

GUICtrlCreateMenuItem("",$Menu2)

$Favorite = IniReadSection(@ScriptDir & "\Config.ini","Favorites")

if not @error then

for $x = 1 to $Favorite[0][0]

$Menuitem[$x+3] = GUICtrlCreateMenuItem($Favorite[$x][0],$Menu2)

Next

EndIf

$Button1 = GUICtrlCreateButton("",10,10,34,34,$BS_ICON)

GUICtrlSetImage(-1,@ScriptFullPath,3)

GUICtrlSetResizing(-1,$GUI_DOCKALL)

$Button2 = GUICtrlCreateButton("",46,10,34,34,$BS_ICON)

GUICtrlSetImage(-1,@ScriptFullPath,4)

GUICtrlSetResizing(-1,$GUI_DOCKALL)

$Button3 = GUICtrlCreateButton("",82,10,34,34,$BS_ICON)

GUICtrlSetImage(-1,@ScriptFullPath,5)

GUICtrlSetResizing(-1,$GUI_DOCKALL)

$Button4 = GUICtrlCreateButton("",118,10,34,34,$BS_ICON)

GUICtrlSetImage(-1,@ScriptFullPath,6)

GUICtrlSetResizing(-1,$GUI_DOCKALL)

$Button5 = GUICtrlCreateButton("",154,10,34,34,$BS_ICON)

GUICtrlSetImage(-1,@ScriptFullPath,7)

GUICtrlSetResizing(-1,$GUI_DOCKALL)

$Input1 = GUICtrlCreateInput(IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"),198,10,582,34)

GUICtrlSetFont(-1,20,400)

GUICtrlSetResizing(-1,$GUI_DOCKALL)

$Obj = GUICtrlCreateObj($Browser,10,54,780,536)

GUICtrlSetState($Button2,$GUI_FOCUS)

$gui2 = GUICreate("Source",800,600,-1,-1,-1,-1,$gui)

$Soruce = GUICtrlCreateEdit("",10,10,780,580,$ES_MULTILINE)

GUISetState(@SW_SHOW,$gui)

GUISetState(@SW_HIDE,$gui2)

_IENavigate($Browser,IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"))

$Currenturl = _IEPropertyGet($Browser,"locationurl")

$title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")

if not @error Then

WinSetTitle($Gui,"","Alek's Web Browser - " & $title[0])

Else

WinSetTitle($Gui,"",GUICtrlRead($Input1))

EndIf

$Temp = 0

Do

$Msg = GUIGetMsg(1)

Switch $Msg[0]

Case $Button1

_IEAction($Browser,"back")

GUICtrlSetState($Button2,$GUI_FOCUS)

Case $Button2

_IENavigate($Browser,GUICtrlRead($Input1),0)

$title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")

if not @error Then

WinSetTitle($Gui,"",$title[0])

Else

WinSetTitle($Gui,"",GUICtrlRead($Input1))

EndIf

Case $Button3

_IENavigate($Browser,IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"))

GUICtrlSetState($Button2,$GUI_FOCUS)

Case $Button4

_IEAction($Browser,"Stop")

GUICtrlSetState($Button2,$GUI_FOCUS)

Case $Button5

_IEAction($Browser,"Forward")

GUICtrlSetState($Button2,$GUI_FOCUS)

Case $Menuitem[1]

FileDelete(@TempDir & "\Source.txt")

FileWrite(@TempDir & "\Source.txt",_INetGetSource(GUICtrlRead($Input1)))

GUICtrlSetData($Soruce,FileRead(@TempDir & "\Source.txt"))

GUISetState(@SW_SHOW,$gui2)

Case $Menuitem[2]

$Home = InputBox("Alek's Web Browser","Change your Start page",_IEPropertyGet($Browser,"locationurl"))

if $Home <> "" and $Home <> 1 then IniWrite(@ScriptDir & "\Config.ini","Config","Home",$Home)

Case $Menuitem[3]

_Favorites()

Case $GUI_EVENT_CLOSE

if $msg[1] = $gui2 Then

GUISetState(@SW_HIDE,$gui2)

Elseif $msg[1] = $gui Then

Exit

EndIf

EndSwitch

if IsArray($Favorite) then

for $x = 1 to $Favorite[0][0]

if $msg[0] = $Menuitem[$x+3] Then

_IENavigate($Browser,IniRead(@ScriptDir & "\config.ini","Favorites",$Favorite[$x][0],"Error"))

EndIf

Next

EndIf

_setcontrolsize()

if _IEPropertyGet($Browser,"locationurl") <> $Currenturl then

GUICtrlSetData($Input1,_IEPropertyGet($Browser,"locationurl"))

$title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")

if not @error Then

WinSetTitle($Gui,"","Alek's Web Browser - " & $title[0])

Else

WinSetTitle($Gui,"",GUICtrlRead($Input1))

EndIf

$Currenturl = _IEPropertyGet($Browser,"locationurl")

EndIf

Until 1=2

Func _setcontrolsize()

$Pos = WinGetPos($Gui)

if $Pos[2] <> $Width or $Pos[3] <> $Hight Then

GUICtrlSetPos($Input1,198,10,$Pos[2]-218,34)

GUICtrlSetPos($Obj,10,54,$Pos[2]-30,$Pos[3]-119)

$Width = $Pos[2]

$Hight = $Pos[3]

EndIf

EndFunc

Func _Favorites()

$Form1 = GUICreate("Alek's Web Browser", 295, 120, 193, 115)

$Label1 = GUICtrlCreateLabel("Enter the URL (http://www.myfavoritesite.com) and the of the Page you want to add to you Favorites list", 5, 5, 278, 32, $SS_CENTER)

$Input2 = GUICtrlCreateInput(_IEPropertyGet($Browser,"locationurl"), 70, 45, 216, 21)

$Label2 = GUICtrlCreateLabel("Page URL", 5, 45, 54, 17)

$Label3 = GUICtrlCreateLabel("Page Name", 5, 70, 60, 17)

$title2 = _StringBetween(_INetGetSource(GUICtrlRead($Input2)),"<Title>","</Title>")

$Input3 = GUICtrlCreateInput($title2[0], 70, 70, 216, 21)

$Addbutton = GUICtrlCreateButton("Add To Favorites",5,96,286,20)

GUISetState(@SW_SHOW)

do

$nMsg = GUIGetMsg()

Switch $nMsg

Case $Addbutton

if GUICtrlRead($Input2) <> "" and GUICtrlRead($Input3) <> "" then

IniWrite(@ScriptDir & "\Config.ini","Favorites",GUICtrlRead($Input3),GUICtrlRead($Input2))

for $x = 4 to UBound($Menuitem)-1

if $Menuitem[$x]= "" Then

$Menuitem[$x] = GUICtrlCreateMenuItem(GUICtrlRead($Input3),$Menu2)

ExitLoop

$nMsg = $GUI_EVENT_CLOSE

EndIf

Next

$Favorite = IniReadSection(@ScriptDir & "\Config.ini","Favorites")

ExitLoop

GUIDelete($Form1)

EndIf

EndSwitch

Until $nMsg = $GUI_EVENT_CLOSE

GUIDelete($Form1)

EndFunc

you have to use the compiled version for the button icons to work, i can

Link to comment
Share on other sites

Please see if you can create a reproducer. Cut your code down to the bare minimum to demonstrate your problem and then be very clear about what you want someone to to to reproduce your issue. Please explain what you expect your code to do and what happens instead.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

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