Jump to content

IE and Tabs


Jex
 Share

Recommended Posts

After open first link in first tab, If another tab open ( or navigate link ) then in first tab ie disappear.

If you don't understand what i mean then try my script and you can see what is problem.

#include <GUIConstants.au3>
#include <IE.au3>

Global $Tab[10], $oIE[10], $Obj[10]
Global $TabPos1 = 5, $TabPos2 = 5, $TabPos3 = 850, $TabPos4 = 650

$Form = GUICreate("Test", $TabPos3 + 10, $TabPos4 + 30)
$FileMenu = GUICtrlCreateMenu("File")
$FileMenuOpen = GUICtrlCreateMenuItem("Open Link...", $FileMenu)
$CreateTab = GUICtrlCreateTab($TabPos1, $TabPos2, $TabPos3, $TabPos4)
OpenTab(1, "http://www.google.com")
OpenTab(2, "http://www.yahoo.com")
OpenTab(3, "http://www.autoitscript.com/forum/index.php")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $FileMenuOpen
            $Input = InputBox("Open Link", "Link :", "", "", 200, 130)
            If Not @error Then
                For $i = 1 To 10
                    If GUICtrlRead($CreateTab) = $i - 1 Then
                        Navigate($i, $Input)
                        ExitLoop
                    EndIf
                Next
            EndIf
    EndSwitch
WEnd

Func OpenTab($oNum, $oLink = "")
    $Tab[$oNum] = GUICtrlCreateTabItem($oNum)
    $oIE[$oNum] = _IECreateEmbedded()
    $Obj[$oNum] = GUICtrlCreateObj($oIE[$oNum], $TabPos1 + 5, $TabPos2 + 25, $TabPos3 - 10, $TabPos4 - 30)
    If $oLink <> "" Then
        Navigate($oNum, $oLink)
    EndIf
EndFunc   ;==>Open

Func Navigate($nNum, $nLink)
    _IENavigate($oIE[$nNum], $nLink, 0)
    $nLink = StringReplace($nLink, "http://", "")
    $nLink = StringReplace($nLink, "www.", "")
    If StringInStr($nLink, "/") Then
        $nLink = StringSplit($nLink, "/")
        $nLink = $nLink[1]
    EndIf
    If StringLen($nLink) > 25 Then $nLink = StringLeft($nLink, 25) & "..."
    GUICtrlSetData($Tab[$nNum], $nLink)
EndFunc   ;==>Navigate
Edited by Jex
Link to comment
Share on other sites

If after open first link in first tab, another tab navigate link then first tab ie disappear.

If you don't understand what i mean then try my script and you can see what is problem.

So I tried your script. Works fine for what I did. I have no idea what you mean by: "If after open first link in first tab, another tab navigate link then first tab ie disappear."

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

Posted Image

Another ss : http://img220.imageshack.us/img220/7618/clipboard02fu6.jpg

If you look that ss you can understand what is problem.

OpenTab(1, "http://www.google.com")
;OpenTab(2, "http://www.yahoo.com")
;OpenTab(3, "http://www.autoitscript.com/forum/index.php")

Like that working good but if im open another tab, first tab ie disappear until im change tab.

I have no idea what you mean by: "If after open first link in first tab, another tab navigate link then first tab ie disappear."

By the way you are true im explained very bad :) Sorry for my bad english.

After open first link in first tab, If another tab open ( or navigate link ) then in first tab ie disappear.

Edited by Jex
Link to comment
Share on other sites

I clicked from tab to tab and clicked links on each of the pages and had no display problems.

I did expect to have problems because this sort of issue with the IE control and tabs has been discussed in these forums several times before, but I did not this time. I think that one of the symptoms was that if you reduced your window to the tray and then back again it would display fine -- some searching in the forum should find these threads, or perhaps someone who remembers one of them will post a link.

In any case, I had no problem with it. I have IE7 on XP SP2, AutoIt 3.2.0.10

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

This makes the issue more apparent:

#include <GUIConstants.au3>
#include <IE.au3>
#Include <GuiTab.au3>

Global $Tab[10], $oIE[10], $Obj[10]
Global $TabPos1 = 5, $TabPos2 = 5, $TabPos3 = 850, $TabPos4 = 650

$Form = GUICreate("Test", $TabPos3 + 10, $TabPos4 + 30)
$FileMenu = GUICtrlCreateMenu("File")
$FileMenuOpen = GUICtrlCreateMenuItem("Open Link...", $FileMenu)
$CreateTab = GUICtrlCreateTab($TabPos1, $TabPos2, $TabPos3, $TabPos4)
OpenTab(1, "http://www.google.com")
OpenTab(2, "http://www.yahoo.com")
OpenTab(3, "http://www.autoitscript.com/forum/index.php")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $FileMenuOpen
            $Input = InputBox("Open Link", "Link :", "", "", 200, 130)
            If Not @error Then
                For $i = 1 To 10
                    If GUICtrlRead($CreateTab) = $i - 1 Then
                        Navigate($i, $Input)
                        
                        ExitLoop
                    EndIf
                Next
            EndIf
    EndSwitch
WEnd

Func OpenTab($oNum, $oLink = "")
    $Tab[$oNum] = GUICtrlCreateTabItem($oNum)
    $oIE[$oNum] = _IECreateEmbedded()
    $Obj[$oNum] = GUICtrlCreateObj($oIE[$oNum], $TabPos1 + 5, $TabPos2 + 25, $TabPos3 - 10, $TabPos4 - 30)
    If $oLink <> "" Then
        Navigate($oNum, $oLink)
    EndIf
EndFunc   ;==>Open

Func Navigate($nNum, $nLink)
    Sleep(200)
    _IENavigate($oIE[$nNum], $nLink, 0)
    $nLink = StringReplace($nLink, "http://", "")
    $nLink = StringReplace($nLink, "www.", "")
    If StringInStr($nLink, "/") Then
        $nLink = StringSplit($nLink, "/")
        $nLink = $nLink[1]
    EndIf
    If StringLen($nLink) > 25 Then $nLink = StringLeft($nLink, 25) & "..."
    GUICtrlSetData($Tab[$nNum], $nLink)
EndFunc   ;==>Navigate
Link to comment
Share on other sites

Yes, I see it now too with the better description.

This will mask the problem is put in after the initial GUISetState():

Sleep(1000)
WinSetState("Test", "", @SW_HIDE)
WinSetState("Test", "", @SW_SHOW)

Again, this has been discussed several times before in the forums... some searching would be prudent.

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

Yes, I see it now too with the better description.

This will mask the problem is put in after the initial GUISetState():

Sleep(1000)
WinSetState("Test", "", @SW_HIDE)
WinSetState("Test", "", @SW_SHOW)

Again, this has been discussed several times before in the forums... some searching would be prudent.

Dale

I'm searched before post here but didn't found solution.

1000 sleep not enough for my pc ( with +3000 sleep working good )

But i think that not good solution. :)

Edited by Jex
Link to comment
Share on other sites

I agree that is not a good solution. I'm also not suggesting that the other posts I'm referring to are easy to find... I looked and didn't find them either, but there are a few.

Psalty -- I think I recall you replying to one recently... are you able to add anything?

thanks,

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

Very odd results here:

#include <GUIConstants.au3>
#include <IE.au3>
#Include <GuiTab.au3>
HotKeySet( "!t", "test" )
Global $Tab[10], $oIE[10], $Obj[10]
Global $TabPos1 = 5, $TabPos2 = 5, $TabPos3 = 850, $TabPos4 = 650

$Form = GUICreate("Test", $TabPos3 + 10, $TabPos4 + 30)
$FileMenu = GUICtrlCreateMenu("File")
$FileMenuOpen = GUICtrlCreateMenuItem("Open Link...", $FileMenu)
$CreateTab = GUICtrlCreateTab($TabPos1, $TabPos2, $TabPos3, $TabPos4)
GUISetState()
OpenTab(1, "http://www.google.com")
OpenTab(2, "http://www.yahoo.com")
OpenTab(3, "http://www.autoitscript.com/forum/index.php")


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $FileMenuOpen
            $Input = InputBox("Open Link", "Link :", "", "", 200, 130)
            If Not @error Then
                For $i = 1 To 10
                    If GUICtrlRead($CreateTab) = $i - 1 Then
                        Navigate($i, $Input)
                        ExitLoop
                    EndIf
                Next
            EndIf
    EndSwitch
WEnd

Func OpenTab($oNum, $oLink = "")
    $Tab[$oNum] = GUICtrlCreateTabItem($oNum)
    $oIE[$oNum] = _IECreateEmbedded()
    $Obj[$oNum] = GUICtrlCreateObj($oIE[$oNum], $TabPos1 + 5, $TabPos2 + 25, $TabPos3 - 10, $TabPos4 - 30)
    If $oLink <> "" Then
        Navigate($oNum, $oLink)
    EndIf
EndFunc   ;==>OpenTab

Func Navigate($nNum, $nLink)
    _GUICtrlTab_SetCurSel( $CreateTab, $nNum - 1 )
    _IENavigate($oIE[$nNum], $nLink, 0)
    $nLink = StringReplace($nLink, "http://", "")
    $nLink = StringReplace($nLink, "www.", "")
    If StringInStr($nLink, "/") Then
        $nLink = StringSplit($nLink, "/")
        $nLink = $nLink[1]
    EndIf
    If StringLen($nLink) > 25 Then $nLink = StringLeft($nLink, 25) & "..." 
    GUICtrlSetData($Tab[$nNum], $nLink)
    While _IEPropertyGet( $oIE[$nNum], "busy" )
        Sleep(10)
    WEnd
;~  test()
EndFunc   ;==>Navigate
Func test()
;~  Sleep(3000)
    $curr = _GUICtrlTab_GetCurSel($CreateTab)
    GUICtrlSetState( $Obj[$curr + 1], $GUI_Hide )
    GUICtrlSetState( $Obj[$curr + 1], $GUI_Show )
EndFunc   ;==>test

Now it will open them all ok in their own tab, and leave you on tab 3.... problem is, on tab three, you see the autoit site, but if you move the mouse around a bit, you discover, you are actually on google....

Posted Image

Edited by danwilli
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...