Jump to content

Recommended Posts

Posted (edited)

Hi i have a problem with my progress bar. Il Im click on <--- or ---> or Réactualiser the progress bar doesn't work.

And i want to press Enter on AdressBar.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <string.au3>
#include <ProgressConstants.au3>

Dim $s_html
_IEErrorHandlerRegister ()
$ie = _IECreateEmbedded ()



$Form1_1 = GUICreate("Form1", 801, 584, 196, 122, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$label1 = GUICtrlCreateLabel("Adresse :", 0, 0, 71, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 72, 0, 681, 21)
$MyButton1 = GUICtrlCreateButton("<----", 0, 24, 100, 30, $BS_FLAT)
$MyButton2 = GUICtrlCreateButton("---->", 104, 24, 100, 30, $BS_FLAT)
$MyButton3 = GUICtrlCreateButton("Actualiser", 208, 24, 108, 30, $BS_FLAT)
$gobuton = GUICtrlCreateButton("Go", 752, 0, 52, 22, $BS_FLAT)
$ProgressBar = GUICtrlCreateProgress(320, 32, 129, 17)

GUISetState(@SW_SHOW)

GuiSetState()
$inter = GUICtrlCreateObj($ie,0, 56, 799, 530)
$SinkObject=ObjEvent($ie,"IEEvent_","DWebBrowserEvents2")
GUICtrlSetResizing($inter, $GUI_DOCKAUTO + $GUI_DOCKBOTTOM + $GUI_DOCKTOP)
GUICtrlSetResizing($MyButton1,$GUI_DOCKALL)
GUICtrlSetResizing($MyButton2,$GUI_DOCKALL)
GUICtrlSetResizing($MyButton3,$GUI_DOCKALL)
GUICtrlSetResizing($ProgressBar,$GUI_DOCKALL)
GUICtrlSetResizing($Input1, $GUI_DOCKRIGHT + $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT)
Sleep(1000)
_IENavigate ($ie, "http://www.google.ca")




$ancien = ""
Func IEEvent_ProgressChange($Progress,$ProgressMax)
    If $ProgressMax > 0 Then
        GUICtrlSetData($ProgressBar, ($Progress * 100) / $ProgressMax )
    EndIf
EndFunc

While 1

$nouveau = _IEPropertyGet($ie, "locationurl")
If $ancien <> $nouveau Then
GUICtrlSetData($Input1, $nouveau)
$ancien = $nouveau
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit






case $gobuton
_IENavigate ($ie, GUICtrlRead($Input1))



Case $MyButton1
_IEAction ($IE, "back")

Case $MyButton2
_IEAction ($IE, "forward")

Case $MyButton3
_IEAction($ie, "refresh")


EndSwitch
WEnd
Edited by SuperAutoit
Posted

Using ENTER on Adressbar is simply :) Just check with _isPressed is ENTER had been pressed and GUICtrlSetState to check if Adressbar have a keyboard focus ;)

But what about those "arrows" I dont now if you not that, but those pages are stored in temp (already downloaded) in because of that those arrows SHOULD'NT update when you are using them B) Am I right ? B)

Posted

Hi, i just talk in english a little bit :)

But now this is my new code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <string.au3>
#include <ProgressConstants.au3>

Dim $s_html
_IEErrorHandlerRegister ()
$ie = _IECreateEmbedded ()



$Form1_1 = GUICreate("Form1", 801, 584, 196, 122, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
GUISetBkColor(0xA6CAF0)
$label1 = GUICtrlCreateLabel("Adresse :", 0, 0, 71, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 72, 0, 449, 21)
$MyButton1 = GUICtrlCreateButton("<----", 0, 24, 100, 30, $BS_FLAT)
$MyButton2 = GUICtrlCreateButton("---->", 104, 24, 100, 30, $BS_FLAT)
$MyButton3 = GUICtrlCreateButton("Actualiser", 208, 24, 108, 30, $BS_FLAT)
$gobuton = GUICtrlCreateButton("Go", 520, 0, 52, 22, $BS_FLAT)
$ProgressBar = GUICtrlCreateProgress(320, 32, 129, 17)
$search = GUICtrlCreateInput("Google Recherche", 576, 0, 185, 21)
$searchgobuton = GUICtrlCreateButton("Go", 760, 0, 44, 22, $BS_FLAT)


GUISetState(@SW_SHOW)

GuiSetState()
$inter = GUICtrlCreateObj($ie,0, 56, 799, 530)
$SinkObject=ObjEvent($ie,"IEEvent_","DWebBrowserEvents")
_IENavigate ($ie, "http://www.google.ca")
GUICtrlSetResizing($inter, $GUI_DOCKAUTO + $GUI_DOCKBOTTOM + $GUI_DOCKTOP)
GUICtrlSetResizing($MyButton1,$GUI_DOCKALL)
GUICtrlSetResizing($MyButton2,$GUI_DOCKALL)
GUICtrlSetResizing($MyButton3,$GUI_DOCKALL)
GUICtrlSetResizing($ProgressBar,$GUI_DOCKALL)
GUICtrlSetResizing($Input1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT)
GUICtrlSetResizing($search, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT)
GUICtrlSetResizing($gobuton, $GUI_DOCKAUTO + $GUI_DOCKWIDTH)




$ancien = ""
Func IEEvent_ProgressChange($Progress,$ProgressMax)
    If $ProgressMax >=0  Then
        GUICtrlSetData($ProgressBar, ($Progress * 100) / $ProgressMax )
    EndIf
EndFunc


Func IEEvent_NavigateComplete($URL)
    GUICtrlSetData ( $Input1, $URL)
EndFunc



While 1

$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit



Case $gobuton, $Input1
_IENavigate ($ie, GUICtrlRead($Input1))



Case $MyButton1
_IEAction ($IE, "back")

Case $MyButton2
_IEAction ($IE, "forward")

Case $MyButton3
_IEAction($ie, "refresh")


EndSwitch
WEnd

Whats new?

i can press Enter

but now i want the button Go is past to the adresse bar with the GUICtrlSetResizing

Thanks

Thanks for your help

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
×
×
  • Create New...