WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

User Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Activate IE Tab Via URL

 Keywords: Activate IE Tab Via URL locationURL Control Manager ActivateIeTab Shell.Application 

AddExtender("wwctl44i.dll")

;; Needs additional error checks, etc.
;; Will activate tabs of all IE instance with the targeted partial URL.
#DefineFunction ActivateIeTab(strTabUrl)
   oShell = CreateObject("Shell.Application")
   nTab = 0
   ForEach obj In oShell.Windows
      If StrIndexNC(obj.fullname, "iexplore.exe", 1, @FWDSCAN)
         objApp = obj.Application
         If ObjectTypeGet(objApp) == "DISPATCH"
            hWnd =  objApp.HWND

            ;; Substitution not exactly needed but good enough for
            ;; a quick and dirty example.
            If IsDefined(nTab%hWnd%) Then nTab%hWnd%=nTab%hWnd%+1
            Else  nTab%hWnd%= 1
            strUrl = obj.locationURL
            If StrIndexNC( strUrl, strTabUrl, 1, @FWDSCAN )
               SendKeysTo(cWinIDConvert(hWnd), "^":nTab%hWnd%)
            EndIf
         EndIf
      EndIf
   Next
   oShell=0
   objApp=0
   Return(1)
#EndFunction


;; Make winbatch.com tab active.
ActivateIeTab("winbatch.com")
Exit

Article ID:   W18136
Filename:   Activate IE Tab Via URL.txt
File Created: 2013:12:04:10:34:58
Last Updated: 2013:12:04:10:34:58