Sign in to follow this  
Followers 0
DW1

IE Buffer

10 posts in this topic

I am trying to create a buffer for an embedded IE. I figured, if I used two IE objects, I could have one load the refresh in the background, and then switch them after the load, so all the user sees is a really quick flicker. The flicker that I am getting though, is way longer than I thought it would be. I think it has something to do with hiding and showing the two embedded IE's

If there is a better way to do this? Please let me know, I am more than willing to change the buffer method.

The end result that I am looking for, is a refresh to happen in the background and once the page is refreshed, replace the IE that the user sees with the refreshed one... that way the user doesn't even see the refresh, it looks more like live, instead of laggy PHP loading a page

Share this post


Link to post
Share on other sites



Here is the code.... the problem I am having is the flashing when switching between the display IE and the buffer IE

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("TrayMenuMode", 1)
Opt("TrayIconDebug", 1)

#include <GUIConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GCSS WORLDVIEW APPLET", 612, 542, (@DesktopWidth / 2) - 306, 200)
$Label1 = GUICtrlCreateLabel("GCSS WORLDVIEW INTERFACE", 5, 10, 205, 19, BitOR($SS_CENTER, $SS_SUNKEN))
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$Combo1 = GUICtrlCreateCombo("", 10, 40, 191, 25)
GUICtrlSetData($Combo1, "Product|AntiVirus - Product") ; shortened from actual script
$Group1 = GUICtrlCreateGroup("Choose A View", 220, 0, 121, 61)
$agent = GUICtrlCreateRadio("Agent View", 230, 20, 101, 21)
$interaction = GUICtrlCreateRadio("Interaction View", 230, 40, 101, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Sort Chosen View", 350, 0, 101, 61)
$status = GUICtrlCreateRadio("Status", 360, 20, 51, 21)
$name = GUICtrlCreateRadio("Name", 360, 40, 51, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$oIE1 = _IECreateEmbedded()
$browser1 = GUICtrlCreateObj($oIE1, 10, 70, 591, 461)
$oIE2 = _IECreateEmbedded()
$browser2 = GUICtrlCreateObj($oIE2, 10, 70, 591, 461)
GUICtrlSetState($browser2, $GUI_HIDE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("Refresh Rate (In Secs)", 470, 0, 131, 61)
$timeout = GUICtrlCreateInput("", 510, 12, 51, 21)
$set = GUICtrlCreateButton("Set", 520, 38, 31, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlSetState($interaction, $GUI_CHECKED)
$pane = "InteractionPane" 
GUICtrlSetState($name, $GUI_CHECKED)
$sort = "contact" 
$number = 471
$changed = 1
$refresh = 5000
Global $buffswitch = 1


_IELoadWaitTimeout(100)

AdlibEnable("refresh", $refresh)
$about = TrayCreateItem("About")
$exit = TrayCreateItem("Exit")
refresh()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $agent
            GUICtrlSetState($interaction, $GUI_UNCHECKED)
            GUICtrlSetState($agent, $GUI_CHECKED)
            $pane = "AgentPane" 
            If GUICtrlRead($status) = $GUI_CHECKED Then $sort = "state" 
            If GUICtrlRead($name) = $GUI_CHECKED Then $sort = "agent" 
            $changed = 1
        Case $interaction
            GUICtrlSetState($agent, $GUI_UNCHECKED)
            GUICtrlSetState($interaction, $GUI_CHECKED)
            $pane = "InteractionPane" 
            If GUICtrlRead($status) = $GUI_CHECKED Then $sort = "state" 
            If GUICtrlRead($name) = $GUI_CHECKED Then $sort = "contact" 
            $changed = 1
        Case $status
            GUICtrlSetState($name, $GUI_UNCHECKED)
            GUICtrlSetState($status, $GUI_CHECKED)
            $sort = "state" 
            $changed = 1
        Case $name
            GUICtrlSetState($status, $GUI_UNCHECKED)
            GUICtrlSetState($name, $GUI_CHECKED)
            If $pane = "AgentPane"  Then $sort = "agent" 
            If $pane = "InteractionPane"  Then $sort = "contact" 
            $changed = 1
        Case $Combo1
            Sleep(2000)
            $queue = GUICtrlRead($Combo1)
            Switch $queue
                Case $queue = "GCSS" 
                    $number = "471" 
            EndSwitch
            $changed = 1
        Case $set
            $refresh = (GUICtrlRead($timeout) * 1000)
            AdlibEnable("refresh", $refresh)
    EndSwitch
    If TrayGetMsg() = $about Then MsgBox(64, "About GCSS Worldview Applet", "This applet was created by Andrew Goulart")
    If TrayGetMsg() = $exit Then ExitLoop
WEnd


Func refresh()
    If $changed = 1 Then
        If $buffswitch = 1 Then
            _IENavigate($oIE2, "http://www.google.com")
            GUICtrlSetState($browser2, $GUI_SHOW)
            GUICtrlSetState($browser1, $GUI_HIDE)
            $buffswitch = 2
        Else
            _IENavigate($oIE1, "http://www.google.com")
            GUICtrlSetState($browser1, $GUI_SHOW)
            GUICtrlSetState($browser2, $GUI_HIDE)
            $buffswitch = 1
        EndIf
    Else
        If $buffswitch = 1 Then
            _IENavigate($oIE2, _IEPropertyGet($oIE1, "locationurl"))
            GUICtrlSetState($browser2, $GUI_SHOW)
            GUICtrlSetState($browser1, $GUI_HIDE)
            $buffswitch = 2
        Else
            _IENavigate($oIE1, _IEPropertyGet($oIE2, "locationurl"))
            GUICtrlSetState($browser1, $GUI_SHOW)
            GUICtrlSetState($browser2, $GUI_HIDE)
            $buffswitch = 1
        EndIf
    EndIf
EndFunc   ;==>refresh

I have replaced the company sites with google

why is there such a lag in just hiding one guictrl and showing another?

Share this post


Link to post
Share on other sites

Here is a different approach using iFrames. My example is in a browser, you can put it in a GUI...

Two sites get loaded into iFrames, one visible, one set to 0 height 0 width and then flipped...

#include <IE.au3>
$oIE = _IECreate()
$sHTML = ""
$sHTML &= "<html><title>FrameFlash</title><body>" & @CR
$sHTML &= "<iframe name='one' height=300 width=400 src='http://www.ibm.com'>" & @CR
$sHTML &= "<iframe name='two' height=0 width=0 src='http://www.hp.com'>" & @CR
$sHTML &= "</body></html>" & @CR

_IEBodyWriteHTML($oIE, $sHTML)

$oFrameOne = _IEGetObjByName($oIE, "one")
$oFrameTwo = _IEGetObjByName($oIE, "two")

Sleep (4000)

; GotTo Two
$oFrameOne.height = 0
$oFrameOne.width = 0
$oFrameTwo.height = 300
$oFrameTwo.width = 400

Sleep (4000)

; GotTo One
$oFrameOne.height = 300
$oFrameOne.width = 400
$oFrameTwo.height = 0
$oFrameTwo.width = 0

Sleep (4000)

; GotTo Two
$oFrameOne.height = 0
$oFrameOne.width = 0
$oFrameTwo.height = 300
$oFrameTwo.width = 400

Sleep (4000)

; GotTo One
$oFrameOne.height = 300
$oFrameOne.width = 400
$oFrameTwo.height = 0
$oFrameTwo.width = 0

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

Share this post


Link to post
Share on other sites

Please post the final result (or an example of it). I think it would be quite interesting.

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

Share this post


Link to post
Share on other sites

Will do... I have a meeting tonight, so I need to get some real work done, but I will be able to post my results tomorrow... thanks again

Share this post


Link to post
Share on other sites

I cannot seem to get this to work with an embedded IE (create works fine)... what am I doing wrong?

#include <IE.au3>
#cs
This works:   $oIE = _IECreate()
--------------------------------------------------------------------------
#ce
$oIE = _IECreate()
#cs
--------------------------------------------------------------------------
But This Doesn't:  Embedded  - uncomment these lines to see
--------------------------------------------------------------------------
#ce
;~ $Form1 = GUICreate("test", 612, 542, (@DesktopWidth / 2), 200)
;~ $oIE = _IECreateEmbedded()
;~ $browser = GUICtrlCreateObj($oIE, 10, 70, 591, 461)
; ------------------------------------------------------------------------

$sHTML = ""
$sHTML &= "<html><title>FrameFlash</title><body>" & @CR
$sHTML &= "<iframe name='one' height=300 width=400 src='http://www.ibm.com'>" & @CR
$sHTML &= "<iframe name='two' height=0 width=0 src='http://www.hp.com'>" & @CR
$sHTML &= "</body></html>" & @CR

_IEBodyWriteHTML($oIE, $sHTML)

$oFrameOne = _IEGetObjByName($oIE, "one")
$oFrameTwo = _IEGetObjByName($oIE, "two")

Sleep (4000)

; GotTo Two
$oFrameOne.height = 0
$oFrameOne.width = 0
$oFrameTwo.height = 300
$oFrameTwo.width = 400

Sleep (4000)

; GotTo One
$oFrameOne.height = 300
$oFrameOne.width = 400
$oFrameTwo.height = 0
$oFrameTwo.width = 0

Sleep (4000)

; GotTo Two
$oFrameOne.height = 0
$oFrameOne.width = 0
$oFrameTwo.height = 300
$oFrameTwo.width = 400

Sleep (4000)

; GotTo One
$oFrameOne.height = 300
$oFrameOne.width = 400
$oFrameTwo.height = 0
$oFrameTwo.width = 0

I get this in Scite:

--> IE.au3 V2.3-1 Error from function _IELoadWait, $_IEStatus_InvalidDataType

C:\Program Files\AutoIt3\Include\IE.au3 (2611) : ==> Variable must be of type "Object".:

If IsObj($o_object.document.GetElementsByName ($s_Id).item ($i_index)) Then

If IsObj($o_object.document^ ERROR

->16:41:13 AutoIT3.exe ended.rc:1

Share this post


Link to post
Share on other sites

You need a _IENavigate($oIE, "about:blank") after the $browser = GUICtrlCreateObj($oIE, 10, 70, 591, 461)

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

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  
Followers 0